summaryrefslogtreecommitdiff
path: root/cui
diff options
context:
space:
mode:
authorKatarina Behrens <Katarina.Behrens@cib.de>2016-05-28 08:11:28 +0200
committerKatarina Behrens <Katarina.Behrens@cib.de>2016-06-03 06:46:39 +0000
commit9196de99ed4dff2c1f8708bfd68da9b6424ae53b (patch)
tree2fa498e27babfcbd31c9fc7387932bbc5f60d949 /cui
parentd0879b721d8c429248f9da7ce02c6c71327e2954 (diff)
Move page size listbox from cui to svx
make it a custom widget so it is accessible e.g. to sidebar panels Change-Id: Ic36a9a8af96a09fc76efd8e9ae75b8ebdf81717e Reviewed-on: https://gerrit.libreoffice.org/25764 Reviewed-by: Katarina Behrens <Katarina.Behrens@cib.de> Tested-by: Katarina Behrens <Katarina.Behrens@cib.de>
Diffstat (limited to 'cui')
-rw-r--r--cui/AllLangResTarget_cui.mk1
-rw-r--r--cui/source/inc/cuires.hrc2
-rw-r--r--cui/source/inc/page.hxx3
-rw-r--r--cui/source/tabpages/page.cxx45
-rw-r--r--cui/source/tabpages/page.h69
-rw-r--r--cui/source/tabpages/page.src99
-rw-r--r--cui/uiconfig/ui/pageformatpage.ui2
7 files changed, 9 insertions, 212 deletions
diff --git a/cui/AllLangResTarget_cui.mk b/cui/AllLangResTarget_cui.mk
index 8d5ece0819e7..7cb854c0690a 100644
--- a/cui/AllLangResTarget_cui.mk
+++ b/cui/AllLangResTarget_cui.mk
@@ -49,7 +49,6 @@ $(eval $(call gb_SrsTarget_add_files,cui/res,\
cui/source/options/treeopt.src \
cui/source/tabpages/border.src \
cui/source/tabpages/frmdirlbox.src \
- cui/source/tabpages/page.src \
cui/source/tabpages/paragrph.src \
cui/source/tabpages/strings.src \
))
diff --git a/cui/source/inc/cuires.hrc b/cui/source/inc/cuires.hrc
index f0a8ccd33223..103f74ffd78e 100644
--- a/cui/source/inc/cuires.hrc
+++ b/cui/source/inc/cuires.hrc
@@ -38,8 +38,6 @@
// RID_CUI_GALLERY_END (RID_SVX_START + 410)
// used in "tabpages"
-#define RID_SVXSTRARY_PAPERSIZE_STD (RID_SVX_START + 142)
-#define RID_SVXSTRARY_PAPERSIZE_DRAW (RID_SVX_START + 143)
#define RID_SVXSTR_READ_DATA_ERROR (RID_SVX_START + 230)
#define RID_SVXSTR_TABLE_PRESET_NONE (RID_SVX_START + 969)
#define RID_SVXSTR_TABLE_PRESET_ONLYOUTER (RID_SVX_START + 970)
diff --git a/cui/source/inc/page.hxx b/cui/source/inc/page.hxx
index d2ec71b063a5..67cd991bc662 100644
--- a/cui/source/inc/page.hxx
+++ b/cui/source/inc/page.hxx
@@ -26,6 +26,7 @@
#include <vcl/lstbox.hxx>
#include <svtools/stdctrl.hxx>
#include <svx/pagectrl.hxx>
+#include <svx/papersizelistbox.hxx>
#include <svx/frmdirlbox.hxx>
#include <editeng/svxenum.hxx>
#include <i18nutil/paper.hxx>
@@ -76,7 +77,7 @@ class SvxPageDescPage : public SfxTabPage
static const sal_uInt16 pRanges[];
private:
// paper format
- VclPtr<ListBox> m_pPaperSizeBox;
+ VclPtr<PaperSizeListBox> m_pPaperSizeBox;
VclPtr<MetricField> m_pPaperWidthEdit;
VclPtr<MetricField> m_pPaperHeightEdit;
diff --git a/cui/source/tabpages/page.cxx b/cui/source/tabpages/page.cxx
index 1b72b7e76ae7..93916879a442 100644
--- a/cui/source/tabpages/page.cxx
+++ b/cui/source/tabpages/page.cxx
@@ -47,7 +47,6 @@
#include <dialmgr.hxx>
#include <sfx2/module.hxx>
#include <svl/stritem.hxx>
-#include <svx/dialogs.hrc>
#include <editeng/eerdll.hxx>
#include <editeng/editrids.hrc>
#include <svx/svxids.hrc>
@@ -557,29 +556,8 @@ void SvxPageDescPage::Reset( const SfxItemSet* rSet )
SetMetricValue( *m_pPaperWidthEdit, aPaperSize.Width(), SFX_MAPUNIT_100TH_MM );
m_pPaperSizeBox->Clear();
- sal_Int32 nActPos = LISTBOX_ENTRY_NOTFOUND;
- sal_uInt16 nAryId = RID_SVXSTRARY_PAPERSIZE_STD;
-
- if ( ePaperStart != PAPER_A3 )
- nAryId = RID_SVXSTRARY_PAPERSIZE_DRAW;
- ResStringArray aPaperAry( CUI_RES( nAryId ) );
- sal_uInt32 nCnt = aPaperAry.Count();
-
- sal_Int32 nUserPos = LISTBOX_ENTRY_NOTFOUND;
- for ( sal_uInt32 i = 0; i < nCnt; ++i )
- {
- OUString aStr = aPaperAry.GetString(i);
- Paper eSize = (Paper)aPaperAry.GetValue(i);
- sal_Int32 nPos = m_pPaperSizeBox->InsertEntry( aStr );
- m_pPaperSizeBox->SetEntryData( nPos, reinterpret_cast<void*>((sal_uLong)eSize) );
-
- if ( eSize == ePaper )
- nActPos = nPos;
- if( eSize == PAPER_USER )
- nUserPos = nPos;
- }
- // preselect current paper format - #115915#: ePaper might not be in aPaperSizeBox so use PAPER_USER instead
- m_pPaperSizeBox->SelectEntryPos( nActPos != LISTBOX_ENTRY_NOTFOUND ? nActPos : nUserPos );
+ m_pPaperSizeBox->FillPaperSizeEntries( ( ePaperStart == PAPER_A3 ) ? PaperSizeStd : PaperSizeDraw );
+ m_pPaperSizeBox->SetSelection( ePaper );
// application specific
@@ -975,8 +953,8 @@ IMPL_LINK_NOARG_TYPED(SvxPageDescPage, PaperBinHdl_Impl, Control&, void)
IMPL_LINK_TYPED( SvxPageDescPage, PaperSizeSelect_Impl, ListBox&, rBox, void )
{
- const sal_Int32 nPos = rBox.GetSelectEntryPos();
- Paper ePaper = (Paper)reinterpret_cast<sal_uLong>(m_pPaperSizeBox->GetEntryData( nPos ));
+ PaperSizeListBox& rListBox = static_cast<PaperSizeListBox&>( rBox );
+ Paper ePaper = rListBox.GetSelection();
if ( ePaper != PAPER_USER )
{
@@ -1050,18 +1028,8 @@ IMPL_LINK_NOARG_TYPED(SvxPageDescPage, PaperSizeModify_Impl, Edit&, void)
Size aSize( GetCoreValue( *m_pPaperWidthEdit, eUnit ),
GetCoreValue( *m_pPaperHeightEdit, eUnit ) );
Paper ePaper = SvxPaperInfo::GetSvxPaper( aSize, (MapUnit)eUnit, true );
- sal_Int32 nEntryCount = m_pPaperSizeBox->GetEntryCount();
-
- for ( sal_Int32 i = 0; i < nEntryCount; ++i )
- {
- Paper eTmp = (Paper)reinterpret_cast<sal_uLong>(m_pPaperSizeBox->GetEntryData(i));
- if ( eTmp == ePaper )
- {
- m_pPaperSizeBox->SelectEntryPos(i);
- break;
- }
- }
+ m_pPaperSizeBox->SetSelection( ePaper );
UpdateExample_Impl( true );
}
@@ -1460,8 +1428,7 @@ SfxTabPage::sfxpg SvxPageDescPage::DeactivatePage( SfxItemSet* _pSet )
// Inquiry whether the page margins are beyond the printing area.
// If not, ask user whether they shall be taken.
// If not, stay on the TabPage.
- sal_Int32 nPos = m_pPaperSizeBox->GetSelectEntryPos();
- Paper ePaper = (Paper)reinterpret_cast<sal_uLong>(m_pPaperSizeBox->GetEntryData( nPos ));
+ Paper ePaper = m_pPaperSizeBox->GetSelection();
if ( ePaper != PAPER_SCREEN_4_3 && ePaper != PAPER_SCREEN_16_9 && ePaper != PAPER_SCREEN_16_10 && IsMarginOutOfRange() )
{
diff --git a/cui/source/tabpages/page.h b/cui/source/tabpages/page.h
deleted file mode 100644
index 8ad22787904e..000000000000
--- a/cui/source/tabpages/page.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-#ifndef INCLUDED_CUI_SOURCE_TABPAGES_PAGE_H
-#define INCLUDED_CUI_SOURCE_TABPAGES_PAGE_H
-
-// define ----------------------------------------------------------------
-
-//!! the values of the following defines must correspond to the array position
-//!! of the respective paper size in the file i18nutil/source/utility/paper.cxx
-//!! There are enums for them in i18nutil/inc/i18nutil/paper.hxx but unfortunately
-//!! the resource compiler does not understand enums, thus the enum values need
-//!! to be duplicated here for use in the src file.
-#define PAPERSIZE_A0 0
-#define PAPERSIZE_A1 1
-#define PAPERSIZE_A2 2
-#define PAPERSIZE_A3 3
-#define PAPERSIZE_A4 4
-#define PAPERSIZE_A5 5
-#define PAPERSIZE_B4_ISO 6
-#define PAPERSIZE_B5_ISO 7
-#define PAPERSIZE_LETTER 8
-#define PAPERSIZE_LEGAL 9
-#define PAPERSIZE_TABLOID 10
-#define PAPERSIZE_USER 11
-#define PAPERSIZE_B6_ISO 12
-#define PAPERSIZE_C4 13
-#define PAPERSIZE_C5 14
-#define PAPERSIZE_C6 15
-#define PAPERSIZE_C65 16
-#define PAPERSIZE_DL 17
-#define PAPERSIZE_DIA 18
-#define PAPERSIZE_SCREEN_4_3 19
-#define PAPERSIZE_LEGAL2 24
-#define PAPERSIZE_MONARCH 25
-#define PAPERSIZE_COM675 26
-#define PAPERSIZE_COM9 27
-#define PAPERSIZE_COM10 28
-#define PAPERSIZE_COM11 29
-#define PAPERSIZE_COM12 30
-#define PAPERSIZE_KAI16 31
-#define PAPERSIZE_KAI32 32
-#define PAPERSIZE_KAI32BIG 33
-#define PAPERSIZE_B4_JIS 34
-#define PAPERSIZE_B5_JIS 35
-#define PAPERSIZE_B6_JIS 36
-#define PAPERSIZE_POSTCARD_JP 46
-#define PAPERSIZE_A6 56
-#define PAPERSIZE_SCREEN_16_9 78
-#define PAPERSIZE_SCREEN_16_10 79
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/source/tabpages/page.src b/cui/source/tabpages/page.src
deleted file mode 100644
index a5cdf3ab7bd1..000000000000
--- a/cui/source/tabpages/page.src
+++ /dev/null
@@ -1,99 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#include <cuires.hrc>
-#include "page.h"
-
- // RID_SVXPAGE_PAGE ------------------------------------------------------
-
-StringArray RID_SVXSTRARY_PAPERSIZE_STD
-{
- ItemList [ en-US ] =
- {
- < "A6" ; PAPERSIZE_A6 ; > ;
- < "A5" ; PAPERSIZE_A5 ; > ;
- < "A4" ; PAPERSIZE_A4 ; > ;
- < "A3" ; PAPERSIZE_A3 ; > ;
- < "B6 (ISO)" ; PAPERSIZE_B6_ISO ; > ;
- < "B5 (ISO)" ; PAPERSIZE_B5_ISO ; > ;
- < "B4 (ISO)" ; PAPERSIZE_B4_ISO ; > ;
- < "Letter" ; PAPERSIZE_LETTER ; > ;
- < "Legal" ; PAPERSIZE_LEGAL ; > ;
- < "Long Bond" ; PAPERSIZE_LEGAL2 ; > ;
- < "Tabloid" ; PAPERSIZE_TABLOID ; > ;
- < "B6 (JIS)" ; PAPERSIZE_B6_JIS ; > ;
- < "B5 (JIS)" ; PAPERSIZE_B5_JIS ; > ;
- < "B4 (JIS)" ; PAPERSIZE_B4_JIS ; > ;
- < "16 Kai" ; PAPERSIZE_KAI16; > ;
- < "32 Kai" ; PAPERSIZE_KAI32; > ;
- < "Big 32 Kai" ; PAPERSIZE_KAI32BIG; > ;
- < "User" ; PAPERSIZE_USER ; > ;
- < "DL Envelope" ; PAPERSIZE_DL ; > ;
- < "C6 Envelope" ; PAPERSIZE_C6 ; > ;
- < "C6/5 Envelope" ; PAPERSIZE_C65 ; > ;
- < "C5 Envelope" ; PAPERSIZE_C5 ; > ;
- < "C4 Envelope" ; PAPERSIZE_C4 ; > ;
- < "#6¾ Envelope" ; PAPERSIZE_COM675; > ;
- < "#7¾ (Monarch) Envelope" ; PAPERSIZE_MONARCH; > ;
- < "#9 Envelope" ; PAPERSIZE_COM9; > ;
- < "#10 Envelope" ; PAPERSIZE_COM10; > ;
- < "#11 Envelope" ; PAPERSIZE_COM11; > ;
- < "#12 Envelope" ; PAPERSIZE_COM12; > ;
- < "Japanese Postcard" ; PAPERSIZE_POSTCARD_JP; > ;
- };
-};
-StringArray RID_SVXSTRARY_PAPERSIZE_DRAW
-{
- ItemList [ en-US ] =
- {
- < "A6" ; PAPERSIZE_A6 ; > ;
- < "A5" ; PAPERSIZE_A5 ; > ;
- < "A4" ; PAPERSIZE_A4 ; > ;
- < "A3" ; PAPERSIZE_A3 ; > ;
- < "A2" ; PAPERSIZE_A2 ; > ;
- < "A1" ; PAPERSIZE_A1 ; > ;
- < "A0" ; PAPERSIZE_A0 ; > ;
- < "B6 (ISO)" ; PAPERSIZE_B6_ISO ; > ;
- < "B5 (ISO)" ; PAPERSIZE_B5_ISO ; > ;
- < "B4 (ISO)" ; PAPERSIZE_B4_ISO ; > ;
- < "Letter" ; PAPERSIZE_LETTER ; > ;
- < "Legal" ; PAPERSIZE_LEGAL ; > ;
- < "Long Bond" ; PAPERSIZE_LEGAL2 ; > ;
- < "Tabloid" ; PAPERSIZE_TABLOID ; > ;
- < "B6 (JIS)" ; PAPERSIZE_B6_JIS ; > ;
- < "B5 (JIS)" ; PAPERSIZE_B5_JIS ; > ;
- < "B4 (JIS)" ; PAPERSIZE_B4_JIS ; > ;
- < "16 Kai" ; PAPERSIZE_KAI16; > ;
- < "32 Kai" ; PAPERSIZE_KAI32; > ;
- < "Big 32 Kai" ; PAPERSIZE_KAI32BIG; > ;
- < "User" ; PAPERSIZE_USER ; > ;
- < "DL Envelope" ; PAPERSIZE_DL ; > ;
- < "C6 Envelope" ; PAPERSIZE_C6 ; > ;
- < "C6/5 Envelope" ; PAPERSIZE_C65 ; > ;
- < "C5 Envelope" ; PAPERSIZE_C5 ; > ;
- < "C4 Envelope" ; PAPERSIZE_C4 ; > ;
- < "Dia Slide" ; PAPERSIZE_DIA ; > ;
- < "Screen 4:3" ; PAPERSIZE_SCREEN_4_3 ; > ;
- < "Screen 16:9" ; PAPERSIZE_SCREEN_16_9 ; > ;
- < "Screen 16:10" ; PAPERSIZE_SCREEN_16_10 ; > ;
- < "Japanese Postcard" ; PAPERSIZE_POSTCARD_JP; > ;
- };
-};
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/uiconfig/ui/pageformatpage.ui b/cui/uiconfig/ui/pageformatpage.ui
index 81d376a0ebb5..dd12f7ef38af 100644
--- a/cui/uiconfig/ui/pageformatpage.ui
+++ b/cui/uiconfig/ui/pageformatpage.ui
@@ -55,7 +55,7 @@
</packing>
</child>
<child>
- <object class="GtkComboBox" id="comboPageFormat">
+ <object class="svxcorelo-PaperSizeListBox" id="comboPageFormat">
<property name="visible">True</property>
<property name="can_focus">False</property>
</object>