diff options
author | Caolán McNamara <caolanm@redhat.com> | 2018-04-25 10:19:15 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2018-04-25 21:25:15 +0200 |
commit | fb55ab7c8ed49bdf5d9d0d57ca0741c20cb16451 (patch) | |
tree | 5f7b1637991eb7f518244d775a5bc7999c188e4f /sw | |
parent | 09de927ba60db4ab5c55aae15a0b0d049b298a4c (diff) |
SwVisitingCardPage is now unused
Change-Id: I0d9d3cbcbc9c3e6019dbd220a42c0a18fdd1ca67
Reviewed-on: https://gerrit.libreoffice.org/53442
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/UIConfig_swriter.mk | 1 | ||||
-rw-r--r-- | sw/qa/unit/data/sw-dialogs-test.txt | 1 | ||||
-rw-r--r-- | sw/source/ui/envelp/label1.cxx | 170 | ||||
-rw-r--r-- | sw/source/ui/envelp/labelexp.cxx | 134 | ||||
-rw-r--r-- | sw/source/ui/envelp/swuilabimp.hxx | 43 | ||||
-rw-r--r-- | sw/uiconfig/swriter/ui/cardformatpage.ui | 129 |
6 files changed, 0 insertions, 478 deletions
diff --git a/sw/UIConfig_swriter.mk b/sw/UIConfig_swriter.mk index 9092d085e48d..02b81e3a268c 100644 --- a/sw/UIConfig_swriter.mk +++ b/sw/UIConfig_swriter.mk @@ -105,7 +105,6 @@ $(eval $(call gb_UIConfig_add_uifiles,modules/swriter,\ sw/uiconfig/swriter/ui/cannotsavelabeldialog \ sw/uiconfig/swriter/ui/captiondialog \ sw/uiconfig/swriter/ui/captionoptions \ - sw/uiconfig/swriter/ui/cardformatpage \ sw/uiconfig/swriter/ui/cardmediumpage \ sw/uiconfig/swriter/ui/ccdialog \ sw/uiconfig/swriter/ui/characterproperties \ diff --git a/sw/qa/unit/data/sw-dialogs-test.txt b/sw/qa/unit/data/sw-dialogs-test.txt index 2732cfa830ca..931a40c09c28 100644 --- a/sw/qa/unit/data/sw-dialogs-test.txt +++ b/sw/qa/unit/data/sw-dialogs-test.txt @@ -65,7 +65,6 @@ modules/swriter/ui/businessdatapage.ui modules/swriter/ui/cannotsavelabeldialog.ui modules/swriter/ui/captiondialog.ui modules/swriter/ui/captionoptions.ui -modules/swriter/ui/cardformatpage.ui modules/swriter/ui/cardmediumpage.ui modules/swriter/ui/ccdialog.ui modules/swriter/ui/characterproperties.ui diff --git a/sw/source/ui/envelp/label1.cxx b/sw/source/ui/envelp/label1.cxx index 2b76d2c5b3eb..6ff18b882716 100644 --- a/sw/source/ui/envelp/label1.cxx +++ b/sw/source/ui/envelp/label1.cxx @@ -565,176 +565,6 @@ void SwLabPage::Reset(const SfxItemSet* rSet) m_pSheetButton->Check(); } -void SwVisitingCardPage::ClearUserData() -{ - SvTreeListEntry* pEntry = m_pAutoTextLB->First(); - while(pEntry) - { - delete static_cast<OUString*>(pEntry->GetUserData()); - pEntry = m_pAutoTextLB->Next(pEntry); - } -} - -void SwVisitingCardPage::SetUserData( sal_uInt32 nCnt, - const OUString* pNames, const OUString* pValues ) -{ - for( sal_uInt32 i = 0; i < nCnt; ++i ) - { - SvTreeListEntry* pEntry = m_pAutoTextLB->InsertEntry( pNames[ i ] ); - pEntry->SetUserData( new OUString( pValues[ i ] )); - } -} - -SwVisitingCardPage::SwVisitingCardPage(vcl::Window* pParent, const SfxItemSet& rSet) - : SfxTabPage(pParent, "CardFormatPage", - "modules/swriter/ui/cardformatpage.ui", &rSet) - , pExampleFrame(nullptr) -{ - get(m_pAutoTextLB, "treeview"); - m_pAutoTextLB->set_height_request(m_pAutoTextLB->GetTextHeight() * 16); - get(m_pAutoTextGroupLB, "autotext"); - get(m_pExampleWIN, "preview"); - - m_pAutoTextLB->SetStyle( m_pAutoTextLB->GetStyle() | WB_HSCROLL ); - m_pAutoTextLB->SetSpaceBetweenEntries(0); - m_pAutoTextLB->SetSelectionMode( SelectionMode::Single ); - - SetExchangeSupport(); - m_pAutoTextLB->SetSelectHdl(LINK(this, SwVisitingCardPage, AutoTextSelectTreeListBoxHdl)); - m_pAutoTextGroupLB->SetSelectHdl(LINK(this, SwVisitingCardPage, AutoTextSelectHdl)); - - m_pExampleWIN->Hide(); - - InitFrameControl(); -} - -SwVisitingCardPage::~SwVisitingCardPage() -{ - disposeOnce(); -} - -void SwVisitingCardPage::dispose() -{ - for(sal_Int32 i = 0; i < m_pAutoTextGroupLB->GetEntryCount(); ++i) - delete static_cast<OUString*>(m_pAutoTextGroupLB->GetEntryData( i )); - m_xAutoText = nullptr; - - ClearUserData(); - delete pExampleFrame; - m_pAutoTextLB.clear(); - m_pAutoTextGroupLB.clear(); - m_pExampleWIN.clear(); - SfxTabPage::dispose(); -} - -VclPtr<SfxTabPage> SwVisitingCardPage::Create(TabPageParent pParent, const SfxItemSet* rSet) -{ - return VclPtr<SwVisitingCardPage>::Create(pParent.pParent, *rSet); -} - -void SwVisitingCardPage::ActivatePage(const SfxItemSet& rSet) -{ - Reset( &rSet ); - UpdateFields(); -} - -DeactivateRC SwVisitingCardPage::DeactivatePage(SfxItemSet* _pSet) -{ - if (_pSet) - FillItemSet(_pSet); - return DeactivateRC::LeavePage; -} - -bool SwVisitingCardPage::FillItemSet(SfxItemSet* rSet) -{ - const OUString* pGroup = static_cast<const OUString*>(m_pAutoTextGroupLB->GetSelectedEntryData()); - OSL_ENSURE(pGroup, "no group selected?"); - - if (pGroup) - aLabItem.m_sGlossaryGroup = *pGroup; - - SvTreeListEntry* pSelEntry = m_pAutoTextLB->FirstSelected(); - if(pSelEntry) - aLabItem.m_sGlossaryBlockName = *static_cast<OUString*>(pSelEntry->GetUserData()); - rSet->Put(aLabItem); - return true; -} - -static void lcl_SelectBlock(SvTreeListBox& rAutoTextLB, const OUString& rBlockName) -{ - SvTreeListEntry* pEntry = rAutoTextLB.First(); - while(pEntry) - { - if(*static_cast<OUString*>(pEntry->GetUserData()) == rBlockName) - { - rAutoTextLB.Select(pEntry); - rAutoTextLB.MakeVisible(pEntry); - break; - } - pEntry = rAutoTextLB.Next(pEntry); - } -} - -static bool lcl_FindBlock(SvTreeListBox& rAutoTextLB, const OUString& rBlockName) -{ - SvTreeListEntry* pEntry = rAutoTextLB.First(); - while(pEntry) - { - if(*static_cast<OUString*>(pEntry->GetUserData()) == rBlockName) - { - rAutoTextLB.Select(pEntry); - return true; - } - pEntry = rAutoTextLB.Next(pEntry); - } - return false; -} - -void SwVisitingCardPage::Reset(const SfxItemSet* rSet) -{ - aLabItem = static_cast<const SwLabItem&>( rSet->Get(FN_LABEL) ); - - bool bFound = false; - sal_Int32 i; - for(i = 0; i < m_pAutoTextGroupLB->GetEntryCount(); i++) - if( aLabItem.m_sGlossaryGroup == *static_cast<const OUString*>(m_pAutoTextGroupLB->GetEntryData( i ))) - { - bFound = true; - break; - } - - if(!bFound) - { - // initially search for a group starting with "crd" which is the name of the - // business card AutoTexts - for(i = 0; i < m_pAutoTextGroupLB->GetEntryCount(); i++) - if (static_cast<const OUString*>(m_pAutoTextGroupLB->GetEntryData(i))->startsWith("crd")) - { - bFound = true; - break; - } - } - if(bFound) - { - if(m_pAutoTextGroupLB->GetSelectedEntryPos() != i) - { - m_pAutoTextGroupLB->SelectEntryPos(i); - AutoTextSelectHdl(*m_pAutoTextGroupLB); - } - if(lcl_FindBlock(*m_pAutoTextLB, aLabItem.m_sGlossaryBlockName)) - { - SvTreeListEntry* pSelEntry = m_pAutoTextLB->FirstSelected(); - if( pSelEntry && - *static_cast<OUString*>(pSelEntry->GetUserData()) != aLabItem.m_sGlossaryBlockName) - { - lcl_SelectBlock(*m_pAutoTextLB, aLabItem.m_sGlossaryBlockName); - if(m_xAutoText.is() && pExampleFrame->IsInitialized()) - pExampleFrame->ClearDocument(); - } - } - } -} - SwPrivateDataPage::SwPrivateDataPage(vcl::Window* pParent, const SfxItemSet& rSet) : SfxTabPage(pParent, "PrivateUserPage", "modules/swriter/ui/privateuserpage.ui", &rSet) diff --git a/sw/source/ui/envelp/labelexp.cxx b/sw/source/ui/envelp/labelexp.cxx index 6f7a79623bb9..f6302e7756ec 100644 --- a/sw/source/ui/envelp/labelexp.cxx +++ b/sw/source/ui/envelp/labelexp.cxx @@ -36,140 +36,6 @@ using namespace ::com::sun::star::container; using namespace ::com::sun::star::uno; using namespace ::comphelper; -void SwVisitingCardPage::InitFrameControl() -{ - Link<SwOneExampleFrame&,void> aLink(LINK(this, SwVisitingCardPage, FrameControlInitializedHdl)); - m_pExampleWIN->Show(); - pExampleFrame = new SwOneExampleFrame( *m_pExampleWIN, - EX_SHOW_BUSINESS_CARDS, &aLink ); - - Reference< XComponentContext > xContext = comphelper::getProcessComponentContext(); - - //now the AutoText ListBoxes have to be filled - - m_xAutoText = text::AutoTextContainer::create( xContext ); - - uno::Sequence<OUString> aNames = m_xAutoText->getElementNames(); - const OUString* pGroups = aNames.getConstArray(); - - for(sal_Int32 i = 0; i < aNames.getLength(); ++i) - { - uno::Any aGroup = m_xAutoText->getByName(pGroups[i]); - uno::Reference< text::XAutoTextGroup > xGroup; - aGroup >>= xGroup; - uno::Reference< container::XIndexAccess > xIdxAcc(xGroup, uno::UNO_QUERY); - try - { - if(!xIdxAcc.is() || xIdxAcc->getCount()) - { - uno::Reference< beans::XPropertySet > xPrSet(xGroup, uno::UNO_QUERY); - uno::Any aTitle = xPrSet->getPropertyValue( UNO_NAME_TITLE ); - OUString uTitle; - aTitle >>= uTitle; - const sal_Int32 nEntry = m_pAutoTextGroupLB->InsertEntry(uTitle); - m_pAutoTextGroupLB->SetEntryData(nEntry, new OUString(pGroups[i])); - } - } - catch (const Exception&) - { - } - } - if(m_pAutoTextGroupLB->GetEntryCount()) - { - if(LISTBOX_ENTRY_NOTFOUND == m_pAutoTextGroupLB->GetSelectedEntryPos()) - m_pAutoTextGroupLB->SelectEntryPos(0); - const OUString *pCurGroupName( - static_cast<const OUString*>(m_pAutoTextGroupLB->GetSelectedEntryData())); - if(m_xAutoText->hasByName(*pCurGroupName)) - { - uno::Any aGroup = m_xAutoText->getByName(*pCurGroupName); - try - { - uno::Reference< text::XAutoTextGroup > xGroup; - aGroup >>= xGroup; - uno::Sequence< OUString > aBlockNames = xGroup->getElementNames(); - uno::Sequence< OUString > aTitles = xGroup->getTitles() ; - - SetUserData( aBlockNames.getLength(), aTitles.getConstArray(), - aBlockNames.getConstArray() ); - } - catch (const uno::RuntimeException&) - { - // we'll be her if path settings were wrong - } - } - } -} - -IMPL_LINK_NOARG(SwVisitingCardPage, FrameControlInitializedHdl, SwOneExampleFrame&, void) -{ - SvTreeListEntry* pSel = m_pAutoTextLB->FirstSelected(); - OUString sEntry; - if( pSel ) - sEntry = *static_cast<OUString*>(pSel->GetUserData()); - uno::Reference< text::XTextCursor > & xCursor = pExampleFrame->GetTextCursor(); - OUString uEntry(sEntry); - - if(LISTBOX_ENTRY_NOTFOUND != m_pAutoTextGroupLB->GetSelectedEntryPos()) - { - const OUString *pGroup( static_cast<const OUString*>(m_pAutoTextGroupLB->GetSelectedEntryData()) ); - uno::Any aGroup = m_xAutoText->getByName(*pGroup); - uno::Reference< text::XAutoTextGroup > xGroup; - aGroup >>= xGroup; - - if( !sEntry.isEmpty() && xGroup->hasByName( uEntry ) ) - { - uno::Any aEntry(xGroup->getByName(uEntry)); - uno::Reference< text::XAutoTextEntry > xEntry; - aEntry >>= xEntry; - if(xEntry.is()) - { - uno::Reference< text::XTextRange > xRange(xCursor, uno::UNO_QUERY); - xEntry->applyTo(xRange); - } - UpdateFields(); - } - } -} - -IMPL_LINK_NOARG( SwVisitingCardPage, AutoTextSelectTreeListBoxHdl, SvTreeListBox*, void ) -{ - if(m_xAutoText.is() && pExampleFrame->IsInitialized()) - pExampleFrame->ClearDocument(); -} -IMPL_LINK( SwVisitingCardPage, AutoTextSelectHdl, ListBox&, rBox, void ) -{ - if(m_xAutoText.is()) - { - if (m_pAutoTextGroupLB == &rBox) - { - const OUString *pGroup( static_cast<const OUString*>(m_pAutoTextGroupLB->GetSelectedEntryData())); - uno::Any aGroup = m_xAutoText->getByName(*pGroup); - uno::Reference< text::XAutoTextGroup > xGroup; - aGroup >>= xGroup; - - ClearUserData(); - m_pAutoTextLB->Clear(); - - uno::Sequence<OUString> aBlockNames = xGroup->getElementNames(); - uno::Sequence< OUString > aTitles = xGroup->getTitles() ; - SetUserData( aBlockNames.getLength(), aTitles.getConstArray(), - aBlockNames.getConstArray() ); - } - if(pExampleFrame->IsInitialized()) - pExampleFrame->ClearDocument(); - } -} - -void SwVisitingCardPage::UpdateFields() -{ - uno::Reference< frame::XModel > xModel; - if( pExampleFrame && (xModel = pExampleFrame->GetModel()).is()) - { - SwLabDlg::UpdateFieldInformation(xModel, aLabItem); - } -} - void SwLabDlg::UpdateFieldInformation(uno::Reference< frame::XModel > const & xModel, const SwLabItem& rItem) { uno::Reference< text::XTextFieldsSupplier > xFields(xModel, uno::UNO_QUERY); diff --git a/sw/source/ui/envelp/swuilabimp.hxx b/sw/source/ui/envelp/swuilabimp.hxx index b63c30df324f..79b2e11eb09d 100644 --- a/sw/source/ui/envelp/swuilabimp.hxx +++ b/sw/source/ui/envelp/swuilabimp.hxx @@ -81,49 +81,6 @@ public: SwDBManager* GetDBManager() const { return pDBManager; } }; -class SwOneExampleFrame; -class SwVisitingCardPage : public SfxTabPage -{ - VclPtr<SvTreeListBox> m_pAutoTextLB; - VclPtr<ListBox> m_pAutoTextGroupLB; - VclPtr<vcl::Window> m_pExampleWIN; - - SwLabItem aLabItem; - - SwOneExampleFrame* pExampleFrame; - css::uno::Reference< css::text::XAutoTextContainer2 > m_xAutoText; - - DECL_LINK( AutoTextSelectTreeListBoxHdl, SvTreeListBox*, void ); - DECL_LINK( AutoTextSelectHdl, ListBox&, void ); - DECL_LINK( FrameControlInitializedHdl, SwOneExampleFrame&, void ); - - void InitFrameControl(); - void UpdateFields(); - - void ClearUserData(); - - using SfxTabPage::SetUserData; - void SetUserData( sal_uInt32 nCnt, - const OUString* pNames, - const OUString* pValues ); - - virtual ~SwVisitingCardPage() override; - virtual void dispose() override; - - using TabPage::ActivatePage; - using TabPage::DeactivatePage; - -public: - SwVisitingCardPage(vcl::Window* pParent, const SfxItemSet& rSet); - - static VclPtr<SfxTabPage> Create(TabPageParent pParent, const SfxItemSet* rSet); - - virtual void ActivatePage(const SfxItemSet& rSet) override; - virtual DeactivateRC DeactivatePage(SfxItemSet* pSet) override; - virtual bool FillItemSet(SfxItemSet* rSet) override; - virtual void Reset(const SfxItemSet* rSet) override; -}; - class SwPrivateDataPage : public SfxTabPage { VclPtr<Edit> m_pFirstNameED; diff --git a/sw/uiconfig/swriter/ui/cardformatpage.ui b/sw/uiconfig/swriter/ui/cardformatpage.ui deleted file mode 100644 index 15dbf1d26735..000000000000 --- a/sw/uiconfig/swriter/ui/cardformatpage.ui +++ /dev/null @@ -1,129 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<interface domain="sw"> - <!-- interface-requires gtk+ 3.0 --> - <!-- interface-requires LibreOffice 1.0 --> - <object class="GtkFrame" id="CardFormatPage"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="border_width">6</property> - <property name="label_xalign">0</property> - <property name="shadow_type">none</property> - <child> - <object class="GtkAlignment" id="alignment1"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="top_padding">6</property> - <property name="left_padding">12</property> - <child> - <object class="GtkGrid" id="grid1"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="column_spacing">12</property> - <property name="column_homogeneous">True</property> - <child> - <object class="GtkGrid" id="grid2"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="row_spacing">12</property> - <child> - <object class="GtkGrid" id="grid3"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="row_spacing">6</property> - <child> - <object class="GtkLabel" id="label2"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="xalign">0</property> - <property name="label" translatable="yes" context="cardformatpage|label2">AutoText - Section</property> - <property name="use_underline">True</property> - <property name="mnemonic_widget">autotext</property> - </object> - <packing> - <property name="left_attach">0</property> - <property name="top_attach">0</property> - <property name="width">1</property> - <property name="height">1</property> - </packing> - </child> - <child> - <object class="GtkComboBoxText" id="autotext"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="entry_text_column">0</property> - <property name="id_column">1</property> - </object> - <packing> - <property name="left_attach">0</property> - <property name="top_attach">1</property> - <property name="width">1</property> - <property name="height">1</property> - </packing> - </child> - </object> - <packing> - <property name="left_attach">0</property> - <property name="top_attach">1</property> - <property name="width">1</property> - <property name="height">1</property> - </packing> - </child> - <child> - <object class="svtlo-SvTreeListBox" id="treeview:border"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="hexpand">True</property> - <property name="vexpand">True</property> - <child internal-child="selection"> - <object class="GtkTreeSelection" id="Tree List-selection1"/> - </child> - </object> - <packing> - <property name="left_attach">0</property> - <property name="top_attach">0</property> - <property name="width">1</property> - <property name="height">1</property> - </packing> - </child> - </object> - <packing> - <property name="left_attach">0</property> - <property name="top_attach">0</property> - <property name="width">1</property> - <property name="height">1</property> - </packing> - </child> - <child> - <object class="GtkBox" id="preview"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="hexpand">True</property> - <property name="vexpand">True</property> - <property name="orientation">vertical</property> - <child> - <placeholder/> - </child> - </object> - <packing> - <property name="left_attach">1</property> - <property name="top_attach">0</property> - <property name="width">1</property> - <property name="height">1</property> - </packing> - </child> - </object> - </child> - </object> - </child> - <child type="label"> - <object class="GtkLabel" id="label1"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="label" translatable="yes" context="cardformatpage|label1">Content</property> - <attributes> - <attribute name="weight" value="bold"/> - </attributes> - </object> - </child> - </object> -</interface> |