Kaydet (Commit) c4a91f14 authored tarafından Caolán McNamara's avatar Caolán McNamara

weld SdInsertPagesObjsDlg

Change-Id: Ie8e0eaa6122274d86f2d16597cd928acd15df05c
Reviewed-on: https://gerrit.libreoffice.org/67695
Tested-by: Jenkins
Reviewed-by: 's avatarCaolán McNamara <caolanm@redhat.com>
Tested-by: 's avatarCaolán McNamara <caolanm@redhat.com>
üst 20f6e0ba
......@@ -596,6 +596,9 @@ public:
virtual OUString get_text(const TreeIter& rIter) const = 0;
virtual OUString get_id(const TreeIter& rIter) const = 0;
virtual void scroll_to_row(const TreeIter& rIter) = 0;
virtual bool is_selected(const TreeIter& rIter) const = 0;
virtual void selected_foreach(const std::function<void(TreeIter&)>& func) = 0;
void connect_expanding(const Link<TreeIter&, bool>& rLink) { m_aExpandingHdl = rLink; }
......
......@@ -175,7 +175,7 @@ public:
virtual VclPtr<AbstractSdModifyFieldDlg> CreateSdModifyFieldDlg(weld::Window* pWindow, const SvxFieldData* pInField, const SfxItemSet& rSet) = 0;
virtual VclPtr<AbstractSdSnapLineDlg> CreateSdSnapLineDlg(weld::Window* pParent, const SfxItemSet& rInAttrs, ::sd::View* pView) = 0;
virtual VclPtr<AbstractSdInsertLayerDlg> CreateSdInsertLayerDlg(weld::Window* pParent, const SfxItemSet& rInAttrs, bool bDeletable, const OUString& rStr) = 0;
virtual VclPtr<AbstractSdInsertPagesObjsDlg> CreateSdInsertPagesObjsDlg(vcl::Window* pParent, const SdDrawDocument* pDoc, SfxMedium* pSfxMedium, const OUString& rFileName) = 0;
virtual VclPtr<AbstractSdInsertPagesObjsDlg> CreateSdInsertPagesObjsDlg(weld::Window* pParent, const SdDrawDocument* pDoc, SfxMedium* pSfxMedium, const OUString& rFileName) = 0;
virtual VclPtr<AbstractMorphDlg> CreateMorphDlg(weld::Window* pParent, const SdrObject* pObj1, const SdrObject* pObj2) = 0;
virtual VclPtr<SfxAbstractTabDialog> CreateSdOutlineBulletTabDlg(weld::Window* pParent, const SfxItemSet* pAttr, ::sd::View* pView) = 0;
virtual VclPtr<SfxAbstractTabDialog> CreateSdParagraphTabDlg(weld::Window* pWindow, const SfxItemSet* pAttr) = 0;
......
......@@ -383,7 +383,7 @@ VclPtr<VclAbstractDialog> SdDialogsTest::createDialogByID(sal_uInt32 nID)
CPPUNIT_ASSERT(pDrawDoc);
const OUString aFileName("foo");
pRetval = getSdAbstractDialogFactory()->CreateSdInsertPagesObjsDlg(
getViewShell()->GetActiveWindow(),
getViewShell()->GetFrameWeld(),
pDrawDoc,
nullptr,
aFileName);
......
......@@ -28,43 +28,32 @@
#include <ViewShell.hxx>
SdInsertPagesObjsDlg::SdInsertPagesObjsDlg(
vcl::Window* pWindow, const SdDrawDocument* pInDoc,
weld::Window* pWindow, const SdDrawDocument* pInDoc,
SfxMedium* pSfxMedium, const OUString& rFileName )
: ModalDialog(pWindow, "InsertSlidesDialog",
"modules/sdraw/ui/insertslidesdialog.ui")
, pMedium(pSfxMedium)
, mpDoc(pInDoc)
, rName(rFileName)
: GenericDialogController(pWindow, "modules/sdraw/ui/insertslidesdialog.ui", "InsertSlidesDialog")
, m_pMedium(pSfxMedium)
, m_pDoc(pInDoc)
, m_rName(rFileName)
, m_xLbTree(new SdPageObjsTLV(m_xBuilder->weld_tree_view("tree")))
, m_xCbxLink(m_xBuilder->weld_check_button("links"))
, m_xCbxMasters(m_xBuilder->weld_check_button("backgrounds"))
{
get(m_pLbTree, "tree");
get(m_pCbxMasters, "backgrounds");
get(m_pCbxLink, "links");
m_xLbTree->set_size_request(m_xLbTree->get_approximate_digit_width() * 48,
m_xLbTree->get_height_rows(12));
m_pLbTree->set_width_request(m_pLbTree->approximate_char_width() * 50);
m_pLbTree->set_height_request(m_pLbTree->GetTextHeight() * 12);
m_xLbTree->SetViewFrame( pInDoc->GetDocSh()->GetViewShell()->GetViewFrame() );
m_pLbTree->SetViewFrame( pInDoc->GetDocSh()->GetViewShell()->GetViewFrame() );
m_pLbTree->SetSelectHdl( LINK( this, SdInsertPagesObjsDlg, SelectObjectHdl ) );
m_xLbTree->connect_changed(LINK(this, SdInsertPagesObjsDlg, SelectObjectHdl));
// insert text
if( !pMedium )
SetText( SdResId( STR_INSERT_TEXT ) );
if (!m_pMedium)
m_xDialog->set_title(SdResId(STR_INSERT_TEXT));
Reset();
}
SdInsertPagesObjsDlg::~SdInsertPagesObjsDlg()
{
disposeOnce();
}
void SdInsertPagesObjsDlg::dispose()
{
m_pLbTree.clear();
m_pCbxLink.clear();
m_pCbxMasters.clear();
ModalDialog::dispose();
}
/**
......@@ -73,39 +62,39 @@ void SdInsertPagesObjsDlg::dispose()
*/
void SdInsertPagesObjsDlg::Reset()
{
if( pMedium )
if( m_pMedium )
{
m_pLbTree->SetSelectionMode( SelectionMode::Multiple );
m_xLbTree->set_selection_mode(SelectionMode::Multiple);
// transfer ownership of Medium
m_pLbTree->Fill( mpDoc, pMedium, rName );
m_xLbTree->Fill( m_pDoc, m_pMedium, m_rName );
}
else
{
Image aImgText(StockImage::Yes, BMP_DOC_TEXT);
m_pLbTree->InsertEntry( rName, aImgText, aImgText );
OUString sImgText(BMP_DOC_TEXT);
m_xLbTree->InsertEntry(m_rName, sImgText);
}
m_pCbxMasters->Check();
m_xCbxMasters->set_active(true);
}
std::vector<OUString> SdInsertPagesObjsDlg::GetList( const sal_uInt16 nType )
{
// With Draw documents, we have to return NULL on selection of the document
if( pMedium )
if( m_pMedium )
{
// to ensure that bookmarks are opened
// (when the whole document is selected)
m_pLbTree->GetBookmarkDoc();
m_xLbTree->GetBookmarkDoc();
// If the document is selected (too) or nothing is selected,
// the whole document is inserted (but not more!)
if( m_pLbTree->GetSelectionCount() == 0 ||
( m_pLbTree->IsSelected( m_pLbTree->First() ) ) )
std::unique_ptr<weld::TreeIter> xIter(m_xLbTree->make_iterator());
if (!m_xLbTree->get_iter_first(*xIter) || m_xLbTree->is_selected(*xIter))
return std::vector<OUString>();
}
return m_pLbTree->GetSelectEntryList( nType );
return m_xLbTree->GetSelectEntryList( nType );
}
/**
......@@ -113,7 +102,7 @@ std::vector<OUString> SdInsertPagesObjsDlg::GetList( const sal_uInt16 nType )
*/
bool SdInsertPagesObjsDlg::IsLink()
{
return m_pCbxLink->IsChecked();
return m_xCbxLink->get_active();
}
/**
......@@ -121,18 +110,15 @@ bool SdInsertPagesObjsDlg::IsLink()
*/
bool SdInsertPagesObjsDlg::IsRemoveUnnessesaryMasterPages() const
{
return m_pCbxMasters->IsChecked();
return m_xCbxMasters->get_active();
}
/**
* Enabled and selects end-color-LB
*/
IMPL_LINK_NOARG(SdInsertPagesObjsDlg, SelectObjectHdl, SvTreeListBox*, void)
IMPL_LINK_NOARG(SdInsertPagesObjsDlg, SelectObjectHdl, weld::TreeView&, void)
{
if( m_pLbTree->IsLinkableSelected() )
m_pCbxLink->Enable();
else
m_pCbxLink->Disable();
m_xCbxLink->set_sensitive(m_xLbTree->IsLinkableSelected());
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
......@@ -89,7 +89,10 @@ short AbstractSdInsertLayerDlg_Impl::Execute()
return m_xDlg->run();
}
IMPL_ABSTDLG_BASE(AbstractSdInsertPagesObjsDlg_Impl);
short AbstractSdInsertPagesObjsDlg_Impl::Execute()
{
return m_xDlg->run();
}
short AbstractMorphDlg_Impl::Execute()
{
......@@ -294,17 +297,17 @@ void AbstractSdInsertLayerDlg_Impl::SetHelpId( const OString& rHelpId )
std::vector<OUString> AbstractSdInsertPagesObjsDlg_Impl::GetList(const sal_uInt16 nType)
{
return pDlg->GetList(nType);
return m_xDlg->GetList(nType);
}
bool AbstractSdInsertPagesObjsDlg_Impl::IsLink()
{
return pDlg->IsLink();
return m_xDlg->IsLink();
}
bool AbstractSdInsertPagesObjsDlg_Impl::IsRemoveUnnessesaryMasterPages() const
{
return pDlg->IsRemoveUnnessesaryMasterPages();
return m_xDlg->IsRemoveUnnessesaryMasterPages();
}
void AbstractMorphDlg_Impl::SaveSettings() const
......@@ -406,9 +409,9 @@ VclPtr<AbstractSdInsertLayerDlg> SdAbstractDialogFactory_Impl::CreateSdInsertLay
return VclPtr<AbstractSdInsertLayerDlg_Impl>::Create(std::make_unique<SdInsertLayerDlg>(pParent, rInAttrs, bDeletable, aStr));
}
VclPtr<AbstractSdInsertPagesObjsDlg> SdAbstractDialogFactory_Impl::CreateSdInsertPagesObjsDlg( vcl::Window* pParent, const SdDrawDocument* pDoc, SfxMedium* pSfxMedium, const OUString& rFileName )
VclPtr<AbstractSdInsertPagesObjsDlg> SdAbstractDialogFactory_Impl::CreateSdInsertPagesObjsDlg(weld::Window* pParent, const SdDrawDocument* pDoc, SfxMedium* pSfxMedium, const OUString& rFileName)
{
return VclPtr<AbstractSdInsertPagesObjsDlg_Impl>::Create( VclPtr<SdInsertPagesObjsDlg>::Create( pParent, pDoc, pSfxMedium, rFileName ) );
return VclPtr<AbstractSdInsertPagesObjsDlg_Impl>::Create(std::make_unique<SdInsertPagesObjsDlg>(pParent, pDoc, pSfxMedium, rFileName));
}
VclPtr<AbstractMorphDlg> SdAbstractDialogFactory_Impl::CreateMorphDlg(weld::Window* pParent, const SdrObject* pObj1, const SdrObject* pObj2)
......
......@@ -237,7 +237,14 @@ public:
class SdInsertPagesObjsDlg;
class AbstractSdInsertPagesObjsDlg_Impl : public AbstractSdInsertPagesObjsDlg
{
DECL_ABSTDLG_BASE(AbstractSdInsertPagesObjsDlg_Impl,SdInsertPagesObjsDlg)
private:
std::unique_ptr<SdInsertPagesObjsDlg> m_xDlg;
public:
AbstractSdInsertPagesObjsDlg_Impl(std::unique_ptr<SdInsertPagesObjsDlg> pDlg)
: m_xDlg(std::move(pDlg))
{
}
virtual short Execute() override;
virtual std::vector<OUString> GetList ( const sal_uInt16 nType ) override;
virtual bool IsLink() override;
virtual bool IsRemoveUnnessesaryMasterPages() const override;
......@@ -335,7 +342,7 @@ public:
virtual VclPtr<AbstractSdModifyFieldDlg> CreateSdModifyFieldDlg(weld::Window* pWindow, const SvxFieldData* pInField, const SfxItemSet& rSet) override;
virtual VclPtr<AbstractSdSnapLineDlg> CreateSdSnapLineDlg(weld::Window* pParent, const SfxItemSet& rInAttrs, ::sd::View* pView) override;
virtual VclPtr<AbstractSdInsertLayerDlg> CreateSdInsertLayerDlg(weld::Window* pParent, const SfxItemSet& rInAttrs, bool bDeletable, const OUString& aStr) override;
virtual VclPtr<AbstractSdInsertPagesObjsDlg> CreateSdInsertPagesObjsDlg(vcl::Window* pParent, const SdDrawDocument* pDoc, SfxMedium* pSfxMedium, const OUString& rFileName ) override;
virtual VclPtr<AbstractSdInsertPagesObjsDlg> CreateSdInsertPagesObjsDlg(weld::Window* pParent, const SdDrawDocument* pDoc, SfxMedium* pSfxMedium, const OUString& rFileName ) override;
virtual VclPtr<AbstractMorphDlg> CreateMorphDlg(weld::Window* pParent, const SdrObject* pObj1, const SdrObject* pObj2) override;
virtual VclPtr<SfxAbstractTabDialog> CreateSdOutlineBulletTabDlg(weld::Window* pParent, const SfxItemSet* pAttr, ::sd::View* pView) override;
virtual VclPtr<SfxAbstractTabDialog> CreateSdParagraphTabDlg(weld::Window* pParent, const SfxItemSet* pAttr) override;
......
......@@ -1423,4 +1423,262 @@ SdPageObjsTLB::IconProvider::IconProvider()
{
}
SdPageObjsTLV::SdPageObjsTLV(std::unique_ptr<weld::TreeView> xTreeView)
: m_xTreeView(std::move(xTreeView))
, m_xAccel(::svt::AcceleratorExecute::createAcceleratorHelper())
, m_pDoc(nullptr)
, m_pBookmarkDoc(nullptr)
, m_pMedium(nullptr)
, m_pOwnMedium(nullptr)
, m_bLinkableSelected(false)
, m_bShowAllShapes(false)
{
m_xTreeView->connect_expanding(LINK(this, SdPageObjsTLV, RequestingChildrenHdl));
}
OUString SdPageObjsTLV::GetObjectName(
const SdrObject* pObject,
const bool bCreate) const
{
OUString aRet;
if ( pObject )
{
aRet = pObject->GetName();
if (aRet.isEmpty() && dynamic_cast<const SdrOle2Obj* >(pObject) != nullptr)
aRet = static_cast< const SdrOle2Obj* >( pObject )->GetPersistName();
}
if (bCreate
&& m_bShowAllShapes
&& aRet.isEmpty()
&& pObject!=nullptr)
{
aRet = SdResId(STR_NAVIGATOR_SHAPE_BASE_NAME);
aRet = aRet.replaceFirst("%1", OUString::number(pObject->GetOrdNum() + 1));
}
return aRet;
}
std::vector<OUString> SdPageObjsTLV::GetSelectEntryList(const int nDepth) const
{
std::vector<OUString> aEntries;
m_xTreeView->selected_foreach([this, nDepth, &aEntries](weld::TreeIter& rEntry){
int nListDepth = m_xTreeView->get_iter_depth(rEntry);
if (nListDepth == nDepth)
aEntries.push_back(m_xTreeView->get_text(rEntry));
});
return aEntries;
}
/**
* Checks if it is a draw file and opens the BookmarkDoc depending of
* the provided Docs
*/
SdDrawDocument* SdPageObjsTLV::GetBookmarkDoc(SfxMedium* pMed)
{
if (
!m_pBookmarkDoc ||
(pMed && (!m_pOwnMedium || m_pOwnMedium->GetName() != pMed->GetName()))
)
{
// create a new BookmarkDoc if now one exists or if a new Medium is provided
if (m_pOwnMedium != pMed)
{
CloseBookmarkDoc();
}
if (pMed)
{
// it looks that it is undefined if a Medium was set by Fill() already
DBG_ASSERT( !m_pMedium, "SfxMedium confusion!" );
delete m_pMedium;
m_pMedium = nullptr;
// take over this Medium (currently used only be Navigator)
m_pOwnMedium = pMed;
}
DBG_ASSERT( m_pMedium || pMed, "No SfxMedium provided!" );
if( pMed )
{
// in this mode the document is also owned and controlled by this instance
m_xBookmarkDocShRef = new ::sd::DrawDocShell(SfxObjectCreateMode::STANDARD, true, DocumentType::Impress);
if (m_xBookmarkDocShRef->DoLoad(pMed))
m_pBookmarkDoc = m_xBookmarkDocShRef->GetDoc();
else
m_pBookmarkDoc = nullptr;
}
else if ( m_pMedium )
// in this mode the document is owned and controlled by the SdDrawDocument
// it can be released by calling the corresponding CloseBookmarkDoc method
// successful creation of a document makes this the owner of the medium
m_pBookmarkDoc = const_cast<SdDrawDocument*>(m_pDoc)->OpenBookmarkDoc(m_pMedium);
if ( !m_pBookmarkDoc )
{
std::unique_ptr<weld::MessageDialog> xErrorBox(Application::CreateMessageDialog(m_xTreeView.get(),
VclMessageType::Warning, VclButtonsType::Ok, SdResId(STR_READ_DATA_ERROR)));
xErrorBox->run();
m_pMedium = nullptr; //On failure the SfxMedium is invalid
}
}
return m_pBookmarkDoc;
}
/**
* Entries are inserted only by request (double click)
*/
IMPL_LINK(SdPageObjsTLV, RequestingChildrenHdl, weld::TreeIter&, rFileEntry, bool)
{
if (!m_xTreeView->iter_has_child(rFileEntry))
{
if (GetBookmarkDoc())
{
SdrObject* pObj = nullptr;
OUString sImgPage(BMP_PAGE);
OUString sImgPageObjs(BMP_PAGEOBJS);
OUString sImgObjects(BMP_OBJECTS);
OUString sImgOle(BMP_OLE);
OUString sImgGraphic(BMP_GRAPHIC);
// document name already inserted
// only insert all "normal" ? slides with objects
sal_uInt16 nPage = 0;
const sal_uInt16 nMaxPages = m_pBookmarkDoc->GetPageCount();
std::unique_ptr<weld::TreeIter> xPageEntry;
while (nPage < nMaxPages)
{
SdPage* pPage = static_cast<SdPage*>(m_pBookmarkDoc->GetPage(nPage));
if (pPage->GetPageKind() == PageKind::Standard)
{
OUString sId(OUString::number(1));
m_xTreeView->insert(&rFileEntry, -1, &pPage->GetName(), &sId,
nullptr, nullptr, &sImgPage, false);
if (!xPageEntry)
{
xPageEntry = m_xTreeView->make_iterator(&rFileEntry);
m_xTreeView->iter_children(*xPageEntry);
}
else
m_xTreeView->iter_next_sibling(*xPageEntry);
SdrObjListIter aIter( pPage, SdrIterMode::DeepWithGroups );
while( aIter.IsMore() )
{
pObj = aIter.Next();
OUString aStr( GetObjectName( pObj ) );
if( !aStr.isEmpty() )
{
if( pObj->GetObjInventor() == SdrInventor::Default && pObj->GetObjIdentifier() == OBJ_OLE2 )
{
m_xTreeView->insert(xPageEntry.get(), -1, &aStr, nullptr,
nullptr, nullptr, &sImgOle, false);
}
else if( pObj->GetObjInventor() == SdrInventor::Default && pObj->GetObjIdentifier() == OBJ_GRAF )
{
m_xTreeView->insert(xPageEntry.get(), -1, &aStr, nullptr,
nullptr, nullptr, &sImgGraphic, false);
}
else
{
m_xTreeView->insert(xPageEntry.get(), -1, &aStr, nullptr,
nullptr, nullptr, &sImgObjects, false);
}
}
}
if (m_xTreeView->iter_has_child(*xPageEntry))
{
m_xTreeView->set_expander_image(*xPageEntry, sImgPageObjs);
}
}
nPage++;
}
}
}
return true;
}
void SdPageObjsTLV::SetViewFrame(const SfxViewFrame* pViewFrame)
{
sd::ViewShellBase* pBase = sd::ViewShellBase::GetViewShellBase(pViewFrame);
const css::uno::Reference< css::frame::XFrame > xFrame = pBase->GetMainViewShell()->GetViewFrame()->GetFrame().GetFrameInterface();
m_xAccel->init(::comphelper::getProcessComponentContext(), xFrame);
}
/**
* Close and delete bookmark document
*/
void SdPageObjsTLV::CloseBookmarkDoc()
{
if (m_xBookmarkDocShRef.is())
{
m_xBookmarkDocShRef->DoClose();
m_xBookmarkDocShRef.clear();
// Medium is owned by document, so it's destroyed already
m_pOwnMedium = nullptr;
}
else if (m_pBookmarkDoc)
{
DBG_ASSERT(!m_pOwnMedium, "SfxMedium confusion!");
if (m_pDoc)
{
// The document owns the Medium, so the Medium will be invalid after closing the document
const_cast<SdDrawDocument*>(m_pDoc)->CloseBookmarkDoc();
m_pMedium = nullptr;
}
}
else
{
// perhaps mpOwnMedium provided, but no successful creation of BookmarkDoc
delete m_pOwnMedium;
m_pOwnMedium = nullptr;
}
m_pBookmarkDoc = nullptr;
}
/**
* We insert only the first entry. Children are created on demand.
*/
void SdPageObjsTLV::Fill( const SdDrawDocument* pInDoc, SfxMedium* pInMedium,
const OUString& rDocName )
{
m_pDoc = pInDoc;
// this object now owns the Medium
m_pMedium = pInMedium;
m_aDocName = rDocName;
OUString sImgDoc(BMP_DOC_OPEN);
OUString sId(OUString::number(1));
// insert document name
m_xTreeView->insert(nullptr, -1, &m_aDocName, &sId, nullptr, nullptr, &sImgDoc, true);
}
SdPageObjsTLV::~SdPageObjsTLV()
{
if (m_pBookmarkDoc)
CloseBookmarkDoc();
else
{
// no document was created from mpMedium, so this object is still the owner of it
delete m_pMedium;
}
m_xAccel.reset();
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
......@@ -323,7 +323,7 @@ bool FuInsertFile::InsSDDinDrMode(SfxMedium* pMedium)
mpDocSh->SetWaitCursor( false );
SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create();
vcl::Window* pParent = mpViewShell ? mpViewShell->GetActiveWindow() : nullptr;
weld::Window* pParent = mpViewShell ? mpViewShell->GetFrameWeld() : nullptr;
ScopedVclPtr<AbstractSdInsertPagesObjsDlg> pDlg( pFact->CreateSdInsertPagesObjsDlg(pParent, mpDoc, pMedium, aFile) );
sal_uInt16 nRet = pDlg->Execute();
......@@ -405,7 +405,7 @@ bool FuInsertFile::InsSDDinDrMode(SfxMedium* pMedium)
void FuInsertFile::InsTextOrRTFinDrMode(SfxMedium* pMedium)
{
SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create();
ScopedVclPtr<AbstractSdInsertPagesObjsDlg> pDlg( pFact->CreateSdInsertPagesObjsDlg(mpViewShell->GetActiveWindow(), mpDoc, nullptr, aFile) );
ScopedVclPtr<AbstractSdInsertPagesObjsDlg> pDlg( pFact->CreateSdInsertPagesObjsDlg(mpViewShell->GetFrameWeld(), mpDoc, nullptr, aFile) );
mpDocSh->SetWaitCursor( false );
......
......@@ -20,33 +20,29 @@
#ifndef INCLUDED_SD_SOURCE_UI_INC_INSPAGOB_HXX
#define INCLUDED_SD_SOURCE_UI_INC_INSPAGOB_HXX
#include <vcl/button.hxx>
#include <vcl/dialog.hxx>
#include <vcl/weld.hxx>
#include "sdtreelb.hxx"
class SdDrawDocument;
class SdInsertPagesObjsDlg : public ModalDialog
class SdInsertPagesObjsDlg : public weld::GenericDialogController
{
private:
VclPtr<SdPageObjsTLB> m_pLbTree;
VclPtr<CheckBox> m_pCbxLink;
VclPtr<CheckBox> m_pCbxMasters;
SfxMedium* const m_pMedium;
const SdDrawDocument* m_pDoc;
const OUString& m_rName;
SfxMedium* const pMedium;
const SdDrawDocument* mpDoc;
const OUString& rName;
std::unique_ptr<SdPageObjsTLV> m_xLbTree;
std::unique_ptr<weld::CheckButton> m_xCbxLink;
std::unique_ptr<weld::CheckButton> m_xCbxMasters;
void Reset();
DECL_LINK( SelectObjectHdl, SvTreeListBox*, void );
DECL_LINK(SelectObjectHdl, weld::TreeView&, void);
public:
SdInsertPagesObjsDlg( vcl::Window* pParent,
const SdDrawDocument* pDoc,
SfxMedium* pSfxMedium,
const OUString& rFileName );
virtual ~SdInsertPagesObjsDlg() override;
virtual void dispose() override;
SdInsertPagesObjsDlg(weld::Window* pParent, const SdDrawDocument* pDoc,
SfxMedium* pSfxMedium, const OUString& rFileName);
virtual ~SdInsertPagesObjsDlg() override;
/** returns the list
nType == 0 -> pages
......
......@@ -23,6 +23,7 @@
#include <pres.hxx>
#include <sddllapi.h>
#include <vcl/treelistbox.hxx>
#include <vcl/weld.hxx>
#include <svl/urlbmk.hxx>
#include <tools/ref.hxx>
#include "sdxfer.hxx"
......@@ -296,6 +297,111 @@ private:
SdrObject& rObject) const;
};
class SD_DLLPUBLIC SdPageObjsTLV
{
private:
std::unique_ptr<weld::TreeView> m_xTreeView;
std::unique_ptr<::svt::AcceleratorExecute> m_xAccel;
const SdDrawDocument* m_pDoc;
SdDrawDocument* m_pBookmarkDoc;
SfxMedium* m_pMedium;
SfxMedium* m_pOwnMedium;
bool m_bLinkableSelected;
bool m_bShowAllShapes;
OUString m_aDocName;
::sd::DrawDocShellRef m_xBookmarkDocShRef; ///< for the loading of bookmarks
/** Return the name of the object. When the object has no user supplied
name and the bCreate flag is <TRUE/> then a name is created
automatically. Additionally the mbShowAllShapes flag is taken into
account when there is no user supplied name. When this flag is
<FALSE/> then no name is created.
@param pObject
When this is NULL then an empty string is returned, regardless
of the value of bCreate.
@param bCreate
This flag controls for objects without user supplied name
whether a name is created. When a name is created then this
name is not stored in the object.
*/
OUString GetObjectName (
const SdrObject* pObject,
const bool bCreate = true) const;
void CloseBookmarkDoc();
DECL_LINK(RequestingChildrenHdl, weld::TreeIter&, bool);
public:
SdPageObjsTLV(std::unique_ptr<weld::TreeView> xTreeview);
~SdPageObjsTLV();
void set_size_request(int nWidth, int nHeight)
{
m_xTreeView->set_size_request(nWidth, nHeight);
}
float get_approximate_digit_width() const
{
return m_xTreeView->get_approximate_digit_width();
}
int get_height_rows(int nRows) const
{
return m_xTreeView->get_height_rows(nRows);
}
void set_selection_mode(SelectionMode eMode)
{
m_xTreeView->set_selection_mode(eMode);
}
std::vector<int> get_selected_rows() const
{
return m_xTreeView->get_selected_rows();
}
void connect_changed(const Link<weld::TreeView&, void>& rLink)
{
m_xTreeView->connect_changed(rLink);
}
bool is_selected(const weld::TreeIter& rIter) const
{
return m_xTreeView->is_selected(rIter);
}
bool get_iter_first(weld::TreeIter& rIter) const
{
return m_xTreeView->get_iter_first(rIter);
}
std::unique_ptr<weld::TreeIter> make_iterator()
{
return m_xTreeView->make_iterator();
}
void SetViewFrame(const SfxViewFrame* pViewFrame);
void Fill(const SdDrawDocument*, SfxMedium* pSfxMedium, const OUString& rDocName);
/** return selected entries
nDepth == 0 -> pages
nDepth == 1 -> objects */
std::vector<OUString> GetSelectEntryList(const int nDepth) const;
SdDrawDocument* GetBookmarkDoc(SfxMedium* pMedium = nullptr);
bool IsLinkableSelected() const { return m_bLinkableSelected; }
void InsertEntry(const OUString &rName, const OUString &rExpander)
{
m_xTreeView->insert(nullptr, -1, &rName, nullptr, nullptr, nullptr, &rExpander, false);
}
};
#endif // INCLUDED_SD_SOURCE_UI_INC_SDTREELB_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.18.3 -->
<!-- Generated with glade 3.22.1 -->
<interface domain="sd">
<requires lib="gtk+" version="3.18"/>
<requires lib="LibreOffice" version="1.0"/>
<object class="GtkTreeStore" id="liststore1">
<columns>
<!-- column-name expander -->