[Libreoffice-commits] .: 10 commits - cui/AllLangResTarget_cui.mk cui/source cui/uiconfig cui/UI_cui.mk lingucomponent/source svtools/inc svtools/source sw/uiconfig unotools/inc unotools/source unusedcode.easy vcl/inc vcl/source writerfilter/source
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Thu Oct 4 04:50:40 PDT 2012
cui/AllLangResTarget_cui.mk | 2
cui/UI_cui.mk | 1
cui/source/dialogs/cuicharmap.cxx | 7
cui/source/dialogs/cuires.src | 17
cui/source/dialogs/thesdlg.cxx | 410 ++++++------------
cui/source/dialogs/thesdlg.hrc | 40 -
cui/source/dialogs/thesdlg.src | 146 ------
cui/source/dialogs/thesdlg_impl.hxx | 160 -------
cui/source/inc/chardlg.hxx | 1
cui/source/inc/cuicharmap.hxx | 3
cui/source/inc/cuires.hrc | 3
cui/source/inc/helpid.hrc | 1
cui/source/inc/thesdlg.hxx | 138 +++++-
cui/source/tabpages/chardlg.cxx | 9
cui/uiconfig/ui/thesaurus.ui | 217 +++++++++
lingucomponent/source/lingutil/lingutil.cxx | 103 ++--
svtools/inc/svtools/ctrltool.hxx | 8
svtools/source/control/ctrltool.cxx | 77 ---
svtools/source/misc/langtab.cxx | 20
sw/uiconfig/swriter/ui/charurlpage.ui | 34 -
unotools/inc/unotools/lingucfg.hxx | 2
unotools/source/config/lingucfg.cxx | 58 --
unusedcode.easy | 21
vcl/inc/vcl/arrange.hxx | 1
vcl/inc/vcl/builder.hxx | 1
vcl/inc/vcl/dialog.hxx | 3
vcl/inc/vcl/menu.hxx | 1
vcl/inc/vcl/menubtn.hxx | 17
vcl/inc/vcl/tabctrl.hxx | 1
vcl/source/control/fixed.cxx | 4
vcl/source/control/menubtn.cxx | 77 +++
vcl/source/control/tabctrl.cxx | 9
vcl/source/window/arrange.cxx | 8
vcl/source/window/builder.cxx | 42 +
vcl/source/window/dialog.cxx | 23 -
vcl/source/window/layout.cxx | 95 +++-
writerfilter/source/ooxml/OOXMLFastContextHandler.cxx | 3
37 files changed, 850 insertions(+), 913 deletions(-)
New commits:
commit 0f3f9cb63056715845d9c3565bde69470c73efb2
Author: Caolán McNamara <caolanm at redhat.com>
Date: Thu Oct 4 12:49:08 2012 +0100
Related: rhbz#862467 band-aid when creating embedded object fails
Change-Id: Ie5ecc8f56636e692a6e17a2e8fab0cefd46cdfb4
diff --git a/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx b/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx
index 8670a45..920bf31 100644
--- a/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx
+++ b/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx
@@ -2474,6 +2474,9 @@ void OOXMLFastContextHandlerMath::process()
comphelper::EmbeddedObjectContainer container;
OUString aName;
uno::Reference< embed::XEmbeddedObject > ref = container.CreateEmbeddedObject( name.GetByteSequence(), aName );
+ assert(ref.is());
+ if (!ref.is())
+ return;
uno::Reference< uno::XInterface > component( ref->getComponent(), uno::UNO_QUERY );
// gcc4.4 (and 4.3 and possibly older) have a problem with dynamic_cast directly to the target class,
// so help it with an intermediate cast. I'm not sure what exactly the problem is, seems to be unrelated
commit b243afd8755c2a470c6aa0607f5773bedd026937
Author: Caolán McNamara <caolanm at redhat.com>
Date: Thu Oct 4 11:51:36 2012 +0100
callcatcher: update unused code list
and remove code freshly unused post widget layout introduction
Change-Id: Ifa244391f7f2b565dec10314ca3fd2958dfd87a9
diff --git a/cui/source/dialogs/cuicharmap.cxx b/cui/source/dialogs/cuicharmap.cxx
index 06be057..aea38b9 100644
--- a/cui/source/dialogs/cuicharmap.cxx
+++ b/cui/source/dialogs/cuicharmap.cxx
@@ -170,12 +170,7 @@ short SvxCharacterMap::Execute()
// class SvxShowText =====================================================
-SvxShowText::SvxShowText( Window* pParent, const ResId& rResId, sal_Bool bCenter )
-: Control( pParent, rResId ),
- mbCenter( bCenter)
-{}
-
-SvxShowText::SvxShowText( Window* pParent, sal_Bool bCenter )
+SvxShowText::SvxShowText(Window* pParent, sal_Bool bCenter)
: Control( pParent ),
mbCenter( bCenter)
{}
diff --git a/cui/source/inc/chardlg.hxx b/cui/source/inc/chardlg.hxx
index 90abbb1..ca86ac5 100644
--- a/cui/source/inc/chardlg.hxx
+++ b/cui/source/inc/chardlg.hxx
@@ -60,7 +60,6 @@ protected:
sal_Bool m_bPreviewBackgroundToCharacter;
- SvxCharBasePage(Window* pParent, const ResId& rResIdTabPage, const SfxItemSet&);
SvxCharBasePage(Window* pParent, const rtl::OString& rID, const rtl::OUString& rUIXMLDescription, const SfxItemSet& rItemset);
virtual ~SvxCharBasePage();
diff --git a/cui/source/inc/cuicharmap.hxx b/cui/source/inc/cuicharmap.hxx
index b556a40..58fa72b 100644
--- a/cui/source/inc/cuicharmap.hxx
+++ b/cui/source/inc/cuicharmap.hxx
@@ -49,9 +49,6 @@ class SvxShowText : public Control
{
public:
SvxShowText( Window* pParent,
- const ResId& rResId,
- sal_Bool bCenter = sal_False );
- SvxShowText( Window* pParent,
sal_Bool bCenter = sal_False );
~SvxShowText();
diff --git a/cui/source/tabpages/chardlg.cxx b/cui/source/tabpages/chardlg.cxx
index c2a0228..1d34029 100644
--- a/cui/source/tabpages/chardlg.cxx
+++ b/cui/source/tabpages/chardlg.cxx
@@ -184,14 +184,7 @@ inline SvxFont& SvxCharBasePage::GetPreviewCTLFont()
// -----------------------------------------------------------------------
-SvxCharBasePage::SvxCharBasePage( Window* pParent, const ResId& rResId, const SfxItemSet& rItemset)
- : SfxTabPage( pParent, rResId, rItemset )
- , m_pPreviewWin(NULL)
- , m_bPreviewBackgroundToCharacter( sal_False )
-{
-}
-
-SvxCharBasePage::SvxCharBasePage( Window* pParent, const rtl::OString& rID, const rtl::OUString& rUIXMLDescription, const SfxItemSet& rItemset)
+SvxCharBasePage::SvxCharBasePage(Window* pParent, const rtl::OString& rID, const rtl::OUString& rUIXMLDescription, const SfxItemSet& rItemset)
: SfxTabPage( pParent, rID, rUIXMLDescription, rItemset )
, m_pPreviewWin(NULL)
, m_bPreviewBackgroundToCharacter( sal_False )
diff --git a/svtools/inc/svtools/ctrltool.hxx b/svtools/inc/svtools/ctrltool.hxx
index 4fa4066..f7c4cc5 100644
--- a/svtools/inc/svtools/ctrltool.hxx
+++ b/svtools/inc/svtools/ctrltool.hxx
@@ -92,13 +92,6 @@ Name generiert, der dem Anwender praesentiert werden kann.
--------------------------------------------------------------------------
-XubString FontList::GetFontMapText( const FontInfo& rInfo ) const;
-
-Diese Methode gibt einen Matchstring zurueck, der dem Anwender
-anzeigen soll, welche Probleme es mit diesem Font geben kann.
-
---------------------------------------------------------------------------
-
FontInfo FontList::Get( const String& rName, const String& rStyleName ) const;
Diese Methode sucht aus dem uebergebenen Namen und dem uebergebenen StyleName
@@ -189,7 +182,6 @@ public:
OutputDevice* GetDevice() const { return mpDev; }
OutputDevice* GetDevice2() const { return mpDev2; }
- XubString GetFontMapText( const FontInfo& rInfo ) const;
const XubString& GetNormalStr() const { return maNormal; }
const XubString& GetItalicStr() const { return maNormalItalic; }
diff --git a/svtools/source/control/ctrltool.cxx b/svtools/source/control/ctrltool.cxx
index 3c8ff6c..25b6878 100644
--- a/svtools/source/control/ctrltool.cxx
+++ b/svtools/source/control/ctrltool.cxx
@@ -519,83 +519,6 @@ XubString FontList::GetStyleName( const FontInfo& rInfo ) const
return aStyleName;
}
-// -----------------------------------------------------------------------
-
-XubString FontList::GetFontMapText( const FontInfo& rInfo ) const
-{
- if ( !rInfo.GetName().Len() )
- {
- XubString aEmptryStr;
- return aEmptryStr;
- }
-
- // Search Fontname
- ImplFontListNameInfo* pData = ImplFindByName( rInfo.GetName() );
- if ( !pData )
- {
- if ( !maMapNotAvailable.Len() )
- ((FontList*)this)->maMapNotAvailable = SVT_RESSTR(STR_SVT_FONTMAP_NOTAVAILABLE);
- return maMapNotAvailable;
- }
-
- // search for synthetic style
- sal_uInt16 nType = pData->mnType;
- const XubString& rStyleName = rInfo.GetStyleName();
- if ( rStyleName.Len() )
- {
- sal_Bool bNotSynthetic = sal_False;
- sal_Bool bNoneAvailable = sal_False;
- FontWeight eWeight = rInfo.GetWeight();
- FontItalic eItalic = rInfo.GetItalic();
- ImplFontListFontInfo* pFontInfo = pData->mpFirst;
- while ( pFontInfo )
- {
- if ( (eWeight == pFontInfo->GetWeight()) &&
- (eItalic == pFontInfo->GetItalic()) )
- {
- bNotSynthetic = sal_True;
- break;
- }
-
- pFontInfo = pFontInfo->mpNext;
- }
-
- if ( bNoneAvailable )
- {
- XubString aEmptryStr;
- return aEmptryStr;
- }
- else if ( !bNotSynthetic )
- {
- if ( !maMapStyleNotAvailable.Len() )
- ((FontList*)this)->maMapStyleNotAvailable = SVT_RESSTR(STR_SVT_FONTMAP_STYLENOTAVAILABLE);
- return maMapStyleNotAvailable;
- }
- }
-
- // Only Printer-Font?
- if ( (nType & (FONTLIST_FONTNAMETYPE_PRINTER | FONTLIST_FONTNAMETYPE_SCREEN)) == FONTLIST_FONTNAMETYPE_PRINTER )
- {
- if ( !maMapPrinterOnly.Len() )
- ((FontList*)this)->maMapPrinterOnly = SVT_RESSTR(STR_SVT_FONTMAP_PRINTERONLY);
- return maMapPrinterOnly;
- }
- // Only Screen-Font?
- else if ( (nType & (FONTLIST_FONTNAMETYPE_PRINTER | FONTLIST_FONTNAMETYPE_SCREEN)) == FONTLIST_FONTNAMETYPE_SCREEN
- && rInfo.GetType() == TYPE_RASTER )
- {
- if ( !maMapScreenOnly.Len() )
- ((FontList*)this)->maMapScreenOnly = SVT_RESSTR(STR_SVT_FONTMAP_SCREENONLY);
- return maMapScreenOnly;
- }
- else
- {
- if ( !maMapBoth.Len() )
- ((FontList*)this)->maMapBoth = SVT_RESSTR(STR_SVT_FONTMAP_BOTH);
- return maMapBoth;
- }
-}
-
namespace
{
FontInfo makeMissing(ImplFontListFontInfo* pFontNameInfo, const rtl::OUString &rName,
diff --git a/unotools/inc/unotools/lingucfg.hxx b/unotools/inc/unotools/lingucfg.hxx
index c02dabb..88aaa4a 100644
--- a/unotools/inc/unotools/lingucfg.hxx
+++ b/unotools/inc/unotools/lingucfg.hxx
@@ -216,10 +216,8 @@ public:
// functions returning file URLs to the respective images (if found) and empty string otherwise
::rtl::OUString GetSpellAndGrammarContextSuggestionImage( const ::rtl::OUString &rServiceImplName ) const;
::rtl::OUString GetSpellAndGrammarContextDictionaryImage( const ::rtl::OUString &rServiceImplName ) const;
- ::rtl::OUString GetThesaurusDialogImage( const ::rtl::OUString &rServiceImplName ) const;
::rtl::OUString GetSynonymsContextImage( const ::rtl::OUString &rServiceImplName ) const;
- bool HasVendorImages( const char *pImageName ) const;
bool HasGrammarChecker() const;
};
diff --git a/unotools/source/config/lingucfg.cxx b/unotools/source/config/lingucfg.cxx
index e8956c4..a291a95 100644
--- a/unotools/source/config/lingucfg.cxx
+++ b/unotools/source/config/lingucfg.cxx
@@ -1211,22 +1211,6 @@ rtl::OUString SvtLinguConfig::GetSpellAndGrammarContextDictionaryImage(
return aRes;
}
-
-::rtl::OUString SvtLinguConfig::GetThesaurusDialogImage(
- const ::rtl::OUString &rServiceImplName
-) const
-{
- rtl::OUString aRes;
- if (!rServiceImplName.isEmpty())
- {
- rtl::OUString aImageName( A2OU( "ThesaurusDialogImage" ));
- rtl::OUString aPath( GetVendorImageUrl_Impl( rServiceImplName, aImageName ) );
- aRes = aPath;
- }
- return aRes;
-}
-
-
::rtl::OUString SvtLinguConfig::GetSynonymsContextImage(
const ::rtl::OUString &rServiceImplName
) const
@@ -1241,48 +1225,6 @@ rtl::OUString SvtLinguConfig::GetSpellAndGrammarContextDictionaryImage(
return aRes;
}
-
-bool SvtLinguConfig::HasVendorImages( const char *pImageName ) const
-{
- bool bRes = false;
- if (pImageName)
- {
- try
- {
- uno::Reference< container::XNameAccess > xNA( GetMainUpdateAccess(), uno::UNO_QUERY_THROW );
- xNA.set( xNA->getByName( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Images")) ), uno::UNO_QUERY_THROW );
- xNA.set( xNA->getByName( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("VendorImages")) ), uno::UNO_QUERY_THROW );
-
- uno::Sequence< rtl::OUString > aElementNames( xNA->getElementNames() );
- sal_Int32 nVendors = aElementNames.getLength();
- const rtl::OUString *pVendor = aElementNames.getConstArray();
- for (sal_Int32 i = 0; i < nVendors; ++i)
- {
- uno::Reference< container::XNameAccess > xNA2( xNA->getByName( pVendor[i] ), uno::UNO_QUERY_THROW );
- uno::Sequence< rtl::OUString > aPropNames( xNA2->getElementNames() );
- sal_Int32 nProps = aPropNames.getLength();
- const rtl::OUString *pPropNames = aPropNames.getConstArray();
- for (sal_Int32 k = 0; k < nProps; ++k)
- {
- // for a quicker check we ignore the HC image names here
- const OUString &rName = pPropNames[k];
- if (rName.equalsAscii( pImageName ))
- {
- bRes = true;
- break;
- }
- }
- }
- }
- catch (uno::Exception &)
- {
- DBG_ASSERT( 0, "exception caught. HasVendorImages failed" );
- }
- }
- return bRes;
-}
-
-
bool SvtLinguConfig::HasGrammarChecker() const
{
bool bRes = false;
diff --git a/unusedcode.easy b/unusedcode.easy
index 1ac9306..94904ce 100755
--- a/unusedcode.easy
+++ b/unusedcode.easy
@@ -1,12 +1,18 @@
FontSelectPattern::FontSelectPattern(PhysicalFontFace const&, Size const&, float, int, bool)
-PopupMenu::SetSelectedEntry(unsigned short)
RelatedMultipart::getIds()
SanExtensionImpl::setCertExtn(unsigned char*, unsigned int, unsigned char*, unsigned int, unsigned char)
+ScConditionalFormat::dumpInfo(rtl::OUStringBuffer&) const
ScMenuFloatingWindow::getDoc()
ScVbaFormat<ooo::vba::excel::XRange>::setNumberFormat(com::sun::star::lang::Locale, rtl::OUString const&)
ScVbaFormat<ooo::vba::excel::XStyle>::getAddIndent()
ScVbaFormat<ooo::vba::excel::XStyle>::setAddIndent(com::sun::star::uno::Any const&)
ScVbaFormat<ooo::vba::excel::XStyle>::setNumberFormat(com::sun::star::lang::Locale, rtl::OUString const&)
+SvLBoxTreeList::Clone(SvListEntry*, unsigned long&) const
+SvLBoxTreeList::Prev(SvListEntry*, unsigned short*) const
+SvTreeEntryList::front()
+SvtToolPanelOptions::AddListenerLink(Link const&)
+SvtToolPanelOptions::RemoveListenerLink(Link const&)
+SvxAutoCorrect::DeleteText(String const&, unsigned short)
TextEngine::GetLeftMargin() const
ThumbnailView::GetItemCount() const
ThumbnailView::ImplScroll(Point const&)
@@ -81,14 +87,6 @@ oox::ole::AxFormPageModel::AxFormPageModel()
oox::ole::AxMultiPageModel::AxMultiPageModel()
oox::ole::AxTabStripModel::AxTabStripModel()
oox::xls::BiffDrawingObjectBase::BiffDrawingObjectBase(oox::xls::WorksheetHelper const&)
-sd::ClientBox::GetMinOutputSizePixel() const
-sd::ClientBox::RemoveUnlocked()
-sd::ClientBox::SetScrollHdl(Link const&)
-sd::ClientBox::checkEntries()
-sd::ClientBox::checkIndex(int) const
-sd::ClientBox::prepareChecking()
-sd::ClientBox::removeEntry(sd::ClientInfo const*)
-sd::ClientBox::updateEntry(sd::ClientInfo const*)
sd::Communicator::getTransmitter()
sd::ImagePreparer::notesToHtml(unsigned int)
sd::LeftDrawPaneShell::RegisterInterface(SfxModule*)
@@ -99,5 +97,10 @@ sd::framework::ReadOnlyModeObserver::AddStatusListener(com::sun::star::uno::Refe
sd::framework::ReadOnlyModeObserver::ReadOnlyModeObserver(com::sun::star::uno::Reference<com::sun::star::frame::XController> const&)
sd::framework::ResourceManager::Disable()
sd::framework::ResourceManager::Enable()
+sd::slidesorter::controller::AnimationFunction::Blend(double, double, double)
+sd::slidesorter::controller::AnimationFunction::Linear(double)
+sd::slidesorter::controller::Properties::IsHighContrastModeActive() const
+sd::slidesorter::view::ToolTip::ShowDefaultHelpText()
+sd::slidesorter::view::ToolTip::ShowHelpText(rtl::OUString const&)
std::__cxx1998::vector<SfxFilter*, std::allocator<SfxFilter*> >::~vector()
std::__cxx1998::vector<std::pair<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >::~vector()
diff --git a/vcl/inc/vcl/arrange.hxx b/vcl/inc/vcl/arrange.hxx
index 2197f10..90316bd 100644
--- a/vcl/inc/vcl/arrange.hxx
+++ b/vcl/inc/vcl/arrange.hxx
@@ -347,7 +347,6 @@ namespace vcl
resize();
}
- void setWindow( Window*, sal_Int32 i_nExpandPrio = 0 );
void setChild( boost::shared_ptr<WindowArranger> const &, sal_Int32 i_nExpandPrio = 0 );
// convenience: use for setChild( new WindowArranger( ... ) ) constructs
void setChild( WindowArranger* i_pChild, sal_Int32 i_nExpandPrio = 0 )
diff --git a/vcl/inc/vcl/dialog.hxx b/vcl/inc/vcl/dialog.hxx
index 107c29d..22ca609 100644
--- a/vcl/inc/vcl/dialog.hxx
+++ b/vcl/inc/vcl/dialog.hxx
@@ -91,7 +91,6 @@ protected:
public:
Dialog( Window* pParent, WinBits nStyle = WB_STDDIALOG );
- Dialog( Window* pParent, const ResId& rResId );
Dialog( Window* pParent, const rtl::OString& rID, const rtl::OUString& rUIXMLDescription );
virtual ~Dialog();
diff --git a/vcl/inc/vcl/tabctrl.hxx b/vcl/inc/vcl/tabctrl.hxx
index 1de45f3..f913c0f 100644
--- a/vcl/inc/vcl/tabctrl.hxx
+++ b/vcl/inc/vcl/tabctrl.hxx
@@ -121,7 +121,6 @@ public:
virtual long DeactivatePage();
virtual Size GetOptimalSize(WindowSizeType eType) const;
- void SetMinimumSizePixel( const Size& );
void SetTabPageSizePixel( const Size& rSize );
Size GetTabPageSizePixel() const;
diff --git a/vcl/source/control/tabctrl.cxx b/vcl/source/control/tabctrl.cxx
index a3c6ff6..2ad68d1 100644
--- a/vcl/source/control/tabctrl.cxx
+++ b/vcl/source/control/tabctrl.cxx
@@ -80,7 +80,6 @@ struct ImplTabCtrlData
Point maItemsOffset; // offset of the tabitems
std::vector< ImplTabItem > maItemList;
ListBox* mpListBox;
- Size maMinSize;
};
// -----------------------------------------------------------------------
@@ -2224,18 +2223,12 @@ Size TabControl::calculateRequisition() const
Size TabControl::GetOptimalSize(WindowSizeType eType) const
{
if (eType == WINDOWSIZE_MINIMUM)
- return mpTabCtrlData ? mpTabCtrlData->maMinSize : Size();
+ return Size();
return calculateRequisition();
}
// -----------------------------------------------------------------------
-void TabControl::SetMinimumSizePixel( const Size& i_rSize )
-{
- if( mpTabCtrlData )
- mpTabCtrlData->maMinSize = i_rSize;
-}
-
void TabControl::ReassignPageId(sal_uInt16 nOldId, sal_uInt16 nNewId)
{
for( std::vector< ImplTabItem >::iterator it = mpTabCtrlData->maItemList.begin();
diff --git a/vcl/source/window/arrange.cxx b/vcl/source/window/arrange.cxx
index e24706f..56ad168 100644
--- a/vcl/source/window/arrange.cxx
+++ b/vcl/source/window/arrange.cxx
@@ -774,14 +774,6 @@ void Indenter::resize()
m_aElement.setPosSize( aPt, aSz );
}
-void Indenter::setWindow( Window* i_pWindow, sal_Int32 i_nExpandPrio )
-{
- OSL_VERIFY( (m_aElement.m_pElement == 0 && m_aElement.m_pChild == 0) || i_pWindow == 0 );
- OSL_VERIFY( i_pWindow == 0 || i_pWindow->GetParent() == m_pParentWindow );
- m_aElement.m_pElement = i_pWindow;
- m_aElement.m_nExpandPriority = i_nExpandPrio;
-}
-
void Indenter::setChild( boost::shared_ptr<WindowArranger> const & i_pChild, sal_Int32 i_nExpandPrio )
{
OSL_VERIFY( (m_aElement.m_pElement == 0 && m_aElement.m_pChild == 0 ) || i_pChild == 0 );
diff --git a/vcl/source/window/dialog.cxx b/vcl/source/window/dialog.cxx
index 65a72fb..7a17f0f 100644
--- a/vcl/source/window/dialog.cxx
+++ b/vcl/source/window/dialog.cxx
@@ -547,17 +547,6 @@ Dialog::Dialog( Window* pParent, WinBits nStyle )
ImplInit( pParent, nStyle );
}
-// -----------------------------------------------------------------------
-
-Dialog::Dialog( Window* pParent, const ResId& rResId )
- : SystemWindow( WINDOW_DIALOG )
- , mbIsDefferedInit(false)
-{
- ImplInitDialogData();
- rResId.SetRT( RSC_DIALOG );
- init(pParent, rResId);
-}
-
VclBuilder* VclBuilderContainer::overrideResourceWithUIXML(Window *pWindow, const ResId& rResId)
{
sal_Int32 nUIid = static_cast<sal_Int32>(rResId.GetId());
commit 77407d7ad0cece76eed9e7767765b12229e6449d
Author: Caolán McNamara <caolanm at redhat.com>
Date: Thu Oct 4 11:31:10 2012 +0100
convert thesaurus dialog to .ui format
Change-Id: I58c128b78f19b1141b82c2cecb37ed390a5db82b
diff --git a/cui/AllLangResTarget_cui.mk b/cui/AllLangResTarget_cui.mk
index 4af4058..f3d76a9 100644
--- a/cui/AllLangResTarget_cui.mk
+++ b/cui/AllLangResTarget_cui.mk
@@ -58,6 +58,7 @@ $(eval $(call gb_SrsTarget_add_files,cui/res,\
cui/source/dialogs/colorpicker.src \
cui/source/dialogs/commonlingui.src \
cui/source/dialogs/cuiimapdlg.src \
+ cui/source/dialogs/cuires.src \
cui/source/dialogs/dlgname.src \
cui/source/dialogs/fmsearch.src \
cui/source/dialogs/gallery.src \
@@ -80,7 +81,6 @@ $(eval $(call gb_SrsTarget_add_files,cui/res,\
cui/source/dialogs/srchxtra.src \
cui/source/dialogs/svuidlg.src \
cui/source/dialogs/tbxform.src \
- cui/source/dialogs/thesdlg.src \
cui/source/options/certpath.src \
cui/source/options/connpooloptions.src \
cui/source/options/dbregister.src \
diff --git a/cui/UI_cui.mk b/cui/UI_cui.mk
index c2d51e6..717107d 100644
--- a/cui/UI_cui.mk
+++ b/cui/UI_cui.mk
@@ -14,6 +14,7 @@ $(eval $(call gb_UI_add_uifiles,cui,\
cui/uiconfig/ui/effectspage \
cui/uiconfig/ui/positionpage \
cui/uiconfig/ui/specialcharacters \
+ cui/uiconfig/ui/thesaurus \
cui/uiconfig/ui/twolinespage \
cui/uiconfig/ui/zoomdialog \
))
diff --git a/cui/source/dialogs/cuires.src b/cui/source/dialogs/cuires.src
new file mode 100644
index 0000000..6b7e8fc
--- /dev/null
+++ b/cui/source/dialogs/cuires.src
@@ -0,0 +1,17 @@
+/* -*- 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/.
+ */
+
+#include "cuires.hrc"
+
+String RID_SVXSTR_ERR_TEXTNOTFOUND
+{
+ Text [ en-US ] = "No alternatives found." ;
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/source/dialogs/thesdlg.cxx b/cui/source/dialogs/thesdlg.cxx
index c794b2a..7be748a 100644
--- a/cui/source/dialogs/thesdlg.cxx
+++ b/cui/source/dialogs/thesdlg.cxx
@@ -26,7 +26,6 @@
*
************************************************************************/
-#include "thesdlg.hrc"
#include "thesdlg.hxx"
#include "thesdlg_impl.hxx"
#include "cuires.hrc"
@@ -63,69 +62,83 @@
using namespace ::com::sun::star;
using ::rtl::OUString;
-// class LookUpComboBox_Impl --------------------------------------------------
+// class LookUpComboBox --------------------------------------------------
-LookUpComboBox_Impl::LookUpComboBox_Impl(
- Window *pParent, const ResId &rResId, SvxThesaurusDialog &rImpl ) :
- ComboBox (pParent, rResId),
- m_rDialogImpl( rImpl )
+LookUpComboBox::LookUpComboBox(Window *pParent)
+ : ComboBox(pParent, WB_LEFT|WB_DROPDOWN|WB_VCENTER|WB_3DLOOK)
{
- m_aModifyTimer.SetTimeoutHdl( LINK( this, LookUpComboBox_Impl, ModifyTimer_Hdl ) );
+ SetBestDropDownLineCount();
+
+ m_aModifyTimer.SetTimeoutHdl( LINK( this, LookUpComboBox, ModifyTimer_Hdl ) );
m_aModifyTimer.SetTimeout( 500 );
EnableAutocomplete( sal_False );
}
-LookUpComboBox_Impl::~LookUpComboBox_Impl()
+extern "C" SAL_DLLPUBLIC_EXPORT Window* SAL_CALL makeLookUpComboBox(Window *pParent, VclBuilder::stringmap &)
{
+ return new LookUpComboBox(pParent);
}
-void LookUpComboBox_Impl::Modify()
+void LookUpComboBox::init(SvxThesaurusDialog *pDialog)
+{
+ m_pDialog = pDialog;
+}
+
+LookUpComboBox::~LookUpComboBox()
+{
+}
+
+void LookUpComboBox::Modify()
{
m_aModifyTimer.Start();
}
-IMPL_LINK( LookUpComboBox_Impl, ModifyTimer_Hdl, Timer *, EMPTYARG /*pTimer*/ )
+IMPL_LINK( LookUpComboBox, ModifyTimer_Hdl, Timer *, EMPTYARG /*pTimer*/ )
{
- m_rDialogImpl.LookUp( GetText() );
+ m_pDialog->LookUp( GetText() );
m_aModifyTimer.Stop();
return 0;
}
-// class ReplaceEdit_Impl --------------------------------------------------
+// class ReplaceEdit --------------------------------------------------
-ReplaceEdit_Impl::ReplaceEdit_Impl( Window *pParent, const ResId &rResId )
- : Edit(pParent, rResId)
- , m_pBtn(NULL)
+ReplaceEdit::ReplaceEdit(Window *pParent)
+ : Edit(pParent)
{
}
-ReplaceEdit_Impl::~ReplaceEdit_Impl()
+extern "C" SAL_DLLPUBLIC_EXPORT Window* SAL_CALL makeReplaceEdit(Window *pParent, VclBuilder::stringmap &)
{
+ return new ReplaceEdit(pParent);
}
-void ReplaceEdit_Impl::Modify()
+ReplaceEdit::~ReplaceEdit()
+{
+}
+
+void ReplaceEdit::Modify()
{
if (m_pBtn)
m_pBtn->Enable( GetText().Len() > 0 );
}
-void ReplaceEdit_Impl::SetText( const XubString& rStr )
+void ReplaceEdit::SetText( const XubString& rStr )
{
Edit::SetText( rStr );
Modify();
}
-void ReplaceEdit_Impl::SetText( const XubString& rStr, const Selection& rNewSelection )
+void ReplaceEdit::SetText( const XubString& rStr, const Selection& rNewSelection )
{
Edit::SetText( rStr, rNewSelection );
Modify();
}
-// class ThesaurusAlternativesCtrl_Impl ----------------------------------
+// class ThesaurusAlternativesCtrl ----------------------------------
-AlternativesString_Impl::AlternativesString_Impl(
- ThesaurusAlternativesCtrl_Impl &rControl,
+AlternativesString::AlternativesString(
+ ThesaurusAlternativesCtrl &rControl,
SvLBoxEntry* pEntry, sal_uInt16 nFlags, const String& rStr ) :
SvLBoxString( pEntry, nFlags, rStr ),
@@ -133,7 +146,7 @@ AlternativesString_Impl::AlternativesString_Impl(
{
}
-void AlternativesString_Impl::Paint(
+void AlternativesString::Paint(
const Point& rPos,
SvLBox& rDev, sal_uInt16,
SvLBoxEntry* pEntry )
@@ -154,28 +167,35 @@ void AlternativesString_Impl::Paint(
rDev.SetFont( aOldFont );
}
-ThesaurusAlternativesCtrl_Impl::ThesaurusAlternativesCtrl_Impl(
- Window* pParent,
- SvxThesaurusDialog &rImpl ) :
- SvxCheckListBox( pParent, CUI_RES( CT_THES_ALTERNATIVES ) ),
- m_rDialogImpl( rImpl )
+ThesaurusAlternativesCtrl::ThesaurusAlternativesCtrl(Window* pParent)
+ : SvxCheckListBox(pParent)
{
SetStyle( GetStyle() | WB_CLIPCHILDREN | WB_HSCROLL | WB_FORCE_MAKEVISIBLE );
SetHighlightRange();
}
-ThesaurusAlternativesCtrl_Impl::~ThesaurusAlternativesCtrl_Impl()
+extern "C" SAL_DLLPUBLIC_EXPORT Window* SAL_CALL makeThesaurusAlternativesCtrl(Window *pParent, VclBuilder::stringmap &)
+{
+ return new ThesaurusAlternativesCtrl(pParent);
+}
+
+void ThesaurusAlternativesCtrl::init(SvxThesaurusDialog *pDialog)
+{
+ m_pDialog = pDialog;
+}
+
+ThesaurusAlternativesCtrl::~ThesaurusAlternativesCtrl()
{
ClearExtraData();
}
-void ThesaurusAlternativesCtrl_Impl::ClearExtraData()
+void ThesaurusAlternativesCtrl::ClearExtraData()
{
UserDataMap_t aEmpty;
m_aUserData.swap( aEmpty );
}
-void ThesaurusAlternativesCtrl_Impl::SetExtraData(
+void ThesaurusAlternativesCtrl::SetExtraData(
const SvLBoxEntry *pEntry,
const AlternativesExtraData &rData )
{
@@ -189,7 +209,7 @@ void ThesaurusAlternativesCtrl_Impl::SetExtraData(
m_aUserData[ pEntry ] = rData;
}
-AlternativesExtraData * ThesaurusAlternativesCtrl_Impl::GetExtraData(
+AlternativesExtraData * ThesaurusAlternativesCtrl::GetExtraData(
const SvLBoxEntry *pEntry )
{
AlternativesExtraData *pRes = NULL;
@@ -199,7 +219,7 @@ AlternativesExtraData * ThesaurusAlternativesCtrl_Impl::GetExtraData(
return pRes;
}
-SvLBoxEntry * ThesaurusAlternativesCtrl_Impl::AddEntry( sal_Int32 nVal, const String &rText, bool bIsHeader )
+SvLBoxEntry * ThesaurusAlternativesCtrl::AddEntry( sal_Int32 nVal, const String &rText, bool bIsHeader )
{
SvLBoxEntry* pEntry = new SvLBoxEntry;
String aText;
@@ -211,7 +231,7 @@ SvLBoxEntry * ThesaurusAlternativesCtrl_Impl::AddEntry( sal_Int32 nVal, const St
pEntry->AddItem( new SvLBoxString( pEntry, 0, String() ) ); // add empty column
aText += rText;
pEntry->AddItem( new SvLBoxContextBmp( pEntry, 0, Image(), Image(), 0 ) ); // otherwise crash
- pEntry->AddItem( new AlternativesString_Impl( *this, pEntry, 0, aText ) );
+ pEntry->AddItem( new AlternativesString( *this, pEntry, 0, aText ) );
SetExtraData( pEntry, AlternativesExtraData( rText, bIsHeader ) );
GetModel()->Insert( pEntry );
@@ -222,29 +242,29 @@ SvLBoxEntry * ThesaurusAlternativesCtrl_Impl::AddEntry( sal_Int32 nVal, const St
return pEntry;
}
-void ThesaurusAlternativesCtrl_Impl::KeyInput( const KeyEvent& rKEvt )
+void ThesaurusAlternativesCtrl::KeyInput( const KeyEvent& rKEvt )
{
const KeyCode& rKey = rKEvt.GetKeyCode();
if (rKey.GetCode() == KEY_RETURN || rKey.GetCode() == KEY_ESCAPE)
GetParent()->KeyInput( rKEvt ); // parent will close dialog...
else if (rKey.GetCode() == KEY_SPACE)
- m_rDialogImpl.AlternativesDoubleClickHdl_Impl( this ); // look up current selected entry
+ m_pDialog->AlternativesDoubleClickHdl_Impl( this ); // look up current selected entry
else if (GetEntryCount())
SvxCheckListBox::KeyInput( rKEvt );
}
-void ThesaurusAlternativesCtrl_Impl::Paint( const Rectangle& rRect )
+void ThesaurusAlternativesCtrl::Paint( const Rectangle& rRect )
{
- if (!m_rDialogImpl.WordFound())
+ if (!m_pDialog->WordFound())
{
- Size aTextSize( GetTextWidth( m_rDialogImpl.getErrStr() ), GetTextHeight() );
+ Size aTextSize( GetTextWidth( m_pDialog->getErrStr() ), GetTextHeight() );
aTextSize = LogicToPixel( aTextSize );
Point aPos;
aPos.X() += GetSizePixel().Width() / 2 - aTextSize.Width() / 2;
aPos.Y() += GetSizePixel().Height() / 2;
aPos = PixelToLogic( aPos );
- DrawText( aPos, m_rDialogImpl.getErrStr() );
+ DrawText( aPos, m_pDialog->getErrStr() );
}
else
@@ -312,8 +332,8 @@ bool SvxThesaurusDialog::UpdateAlternativesBox_Impl()
void SvxThesaurusDialog::LookUp( const String &rText )
{
- if (rText != aWordCB.GetText()) // avoid moving of the cursor if the text is the same
- aWordCB.SetText( rText );
+ if (rText != m_pWordCB->GetText()) // avoid moving of the cursor if the text is the same
+ m_pWordCB->SetText( rText );
LookUp_Impl();
}
@@ -322,16 +342,16 @@ IMPL_LINK( SvxThesaurusDialog, LeftBtnHdl_Impl, Button *, pBtn )
if (pBtn && aLookUpHistory.size() >= 2)
{
aLookUpHistory.pop(); // remove current look up word from stack
- aWordCB.SetText( aLookUpHistory.top() ); // retrieve previous look up word
+ m_pWordCB->SetText( aLookUpHistory.top() ); // retrieve previous look up word
aLookUpHistory.pop();
LookUp_Impl();
}
return 0;
}
-IMPL_LINK( SvxThesaurusDialog, LanguageHdl_Impl, MenuButton *, pBtn )
+IMPL_LINK( SvxThesaurusDialog, LanguageHdl_Impl, MenuButton*, pBtn )
{
- PopupMenu *pMenu = aLangMBtn.GetPopupMenu();
+ PopupMenu *pMenu = m_pLangMBtn->GetPopupMenu();
if (pMenu && pBtn)
{
sal_uInt16 nItem = pBtn->GetCurItemId();
@@ -341,7 +361,6 @@ IMPL_LINK( SvxThesaurusDialog, LanguageHdl_Impl, MenuButton *, pBtn )
if (xThesaurus->hasLocale( SvxCreateLocale( nLang ) ))
nLookUpLanguage = nLang;
SetWindowTitle( nLang );
- UpdateVendorImage();
LookUp_Impl();
}
return 0;
@@ -349,7 +368,7 @@ IMPL_LINK( SvxThesaurusDialog, LanguageHdl_Impl, MenuButton *, pBtn )
void SvxThesaurusDialog::LookUp_Impl()
{
- String aText( aWordCB.GetText() );
+ String aText( m_pWordCB->GetText() );
aLookUpText = OUString( aText );
if (!aLookUpText.isEmpty() &&
@@ -359,21 +378,21 @@ void SvxThesaurusDialog::LookUp_Impl()
m_bWordFound = UpdateAlternativesBox_Impl();
m_pAlternativesCT->Enable( m_bWordFound );
- if ( aWordCB.GetEntryPos( aText ) == LISTBOX_ENTRY_NOTFOUND )
- aWordCB.InsertEntry( aText );
+ if ( m_pWordCB->GetEntryPos( aText ) == LISTBOX_ENTRY_NOTFOUND )
+ m_pWordCB->InsertEntry( aText );
- aReplaceEdit.SetText( String() );
- aLeftBtn.Enable( aLookUpHistory.size() > 1 );
+ m_pReplaceEdit->SetText( String() );
+ m_pLeftBtn->Enable( aLookUpHistory.size() > 1 );
}
IMPL_LINK( SvxThesaurusDialog, WordSelectHdl_Impl, ComboBox *, pBox )
{
- if (pBox && !aWordCB.IsTravelSelect()) // act only upon return key and not when traveling with cursor keys
+ if (pBox && !m_pWordCB->IsTravelSelect()) // act only upon return key and not when traveling with cursor keys
{
sal_uInt16 nPos = pBox->GetSelectEntryPos();
String aStr( pBox->GetEntry( nPos ) );
aStr = linguistic::GetThesaurusReplaceText( aStr );
- aWordCB.SetText( aStr );
+ m_pWordCB->SetText( aStr );
LookUp_Impl();
}
@@ -392,7 +411,7 @@ IMPL_LINK( SvxThesaurusDialog, AlternativesSelectHdl_Impl, SvxCheckListBox *, pB
aStr = pData->GetText();
aStr = linguistic::GetThesaurusReplaceText( aStr );
}
- aReplaceEdit.SetText( aStr );
+ m_pReplaceEdit->SetText( aStr );
}
return 0;
}
@@ -410,7 +429,7 @@ IMPL_LINK( SvxThesaurusDialog, AlternativesDoubleClickHdl_Impl, SvxCheckListBox
aStr = linguistic::GetThesaurusReplaceText( aStr );
}
- aWordCB.SetText( aStr );
+ m_pWordCB->SetText( aStr );
if (aStr.Len() > 0)
LookUp_Impl();
}
@@ -429,192 +448,57 @@ IMPL_STATIC_LINK( SvxThesaurusDialog, SelectFirstHdl_Impl, SvxCheckListBox *, pB
return 0;
}
-////////////////////////////////////////////////////////////
-
-static Image lcl_GetImageFromPngUrl( const OUString &rFileUrl )
-{
- Image aRes;
-
- OUString aTmp;
- osl::FileBase::getSystemPathFromFileURL( rFileUrl, aTmp );
-
- Graphic aGraphic;
- const String aFilterName( RTL_CONSTASCII_USTRINGPARAM( IMP_PNG ) );
- if( GRFILTER_OK == GraphicFilter::LoadGraphic( aTmp, aFilterName, aGraphic, NULL, NULL ) )
- {
- aRes = Image( aGraphic.GetBitmapEx() );
- }
- return aRes;
-}
-
-static String lcl_GetThesImplName( const lang::Locale &rLocale )
-{
- String aRes;
-
- uno::Reference< linguistic2::XLinguServiceManager > xLngMgr;
- try
- {
- uno::Reference< lang::XMultiServiceFactory > xMSF( ::comphelper::getProcessServiceFactory(), uno::UNO_QUERY_THROW );
- xLngMgr = uno::Reference< linguistic2::XLinguServiceManager >( xMSF->createInstance(
- OUString( RTL_CONSTASCII_USTRINGPARAM(
- "com.sun.star.linguistic2.LinguServiceManager" ))), uno::UNO_QUERY_THROW );
-
- DBG_ASSERT( xLngMgr.is(), "LinguServiceManager missing" );
- if (xLngMgr.is())
- {
- uno::Sequence< OUString > aServiceNames = xLngMgr->getConfiguredServices(
- OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.linguistic2.Thesaurus")), rLocale );
- // there should be at most one thesaurus configured for each language
- DBG_ASSERT( aServiceNames.getLength() <= 1, "more than one thesaurus found. Should not be possible" );
- if (aServiceNames.getLength() == 1)
- aRes = aServiceNames[0];
- }
- }
- catch (uno::Exception &e)
- {
- (void) e;
- DBG_ASSERT( 0, "failed to get thesaurus" );
- }
-
- return aRes;
-}
-
-void SvxThesaurusDialog::UpdateVendorImage()
-{
- SetUpdateMode( sal_False );
-
- SvtLinguConfig aCfg;
- if (aCfg.HasVendorImages( "ThesaurusDialogImage" ))
- {
- Image aImage;
- String sThesImplName( lcl_GetThesImplName( SvxCreateLocale( nLookUpLanguage ) ) );
- OUString aThesDialogImageUrl( aCfg.GetThesaurusDialogImage( sThesImplName ) );
- if (sThesImplName.Len() > 0 && !aThesDialogImageUrl.isEmpty())
- aImage = Image( lcl_GetImageFromPngUrl( aThesDialogImageUrl ) );
- else
- aImage = aVendorDefaultImage;
- aVendorImageFI.SetImage( aImage );
- }
-
- SetUpdateMode( sal_True );
-}
+// class SvxThesaurusDialog ----------------------------------------------
-IMPL_STATIC_LINK( SvxThesaurusDialog, VendorImageInitHdl, SvxThesaurusDialog*, EMPTYARG )
+SvxThesaurusDialog::SvxThesaurusDialog(
+ Window* pParent,
+ uno::Reference< linguistic2::XThesaurus > xThes,
+ const String &rWord,
+ LanguageType nLanguage)
+ : SvxStandardDialog(pParent, "ThesaurusDialog", "cui/ui/thesaurus.ui")
+ , m_aErrStr(CUI_RESSTR(RID_SVXSTR_ERR_TEXTNOTFOUND))
+ , xThesaurus(NULL)
+ , aLookUpText()
+ , nLookUpLanguage(LANGUAGE_NONE)
+ , m_bWordFound(false)
{
- pThis->SetUpdateMode( sal_False );
+ get(m_pLeftBtn, "left");
- SvtLinguConfig aCfg;
- if (aCfg.HasVendorImages( "ThesaurusDialogImage" ))
- {
- Image aImage( pThis->aVendorDefaultImage );
- pThis->aVendorImageFI.SetImage( aImage );
- pThis->aVendorImageFI.Show();
-
- // move down visible controls according to the vendor images height
- Size aVendorSize = pThis->aVendorImageFI.GetSizePixel();
- Size aImageSize = pThis->aVendorImageFI.GetImage().GetSizePixel();
- if (aImageSize.Height())
- {
- aVendorSize.Height() = aImageSize.Height();
- if(aVendorSize.Width() < aImageSize.Width())
- aVendorSize.Width() = aImageSize.Width();
- pThis->aVendorImageFI.SetSizePixel( aVendorSize );
- }
- const sal_Int32 nDiff = aVendorSize.Height();
- pThis->aVendorImageFI.SetSizePixel( aVendorSize );
- Control* aControls[] = {
- &pThis->aLeftBtn,
- &pThis->aWordText,
- &pThis->aWordCB,
- &pThis->m_aAlternativesText,
- pThis->m_pAlternativesCT.get(),
- &pThis->aReplaceText,
- &pThis->aReplaceEdit,
- &pThis->aFL,
- &pThis->aHelpBtn,
- &pThis->aLangMBtn,
- &pThis->aReplaceBtn,
- &pThis->aCancelBtn,
- 0
- };
- sal_Int32 nControl = 0;
- while (aControls[nControl])
- {
- Point aPos = aControls[nControl]->GetPosPixel();
- aPos.Y() += nDiff;
- aControls[nControl]->SetPosPixel(aPos);
- ++nControl;
- }
- Size aDlgSize = pThis->GetSizePixel();
- aDlgSize.Height() += nDiff;
- pThis->SetSizePixel( aDlgSize );
- pThis->Invalidate();
- }
+ get(m_pWordCB, "wordcb");
+ m_pWordCB->init(this);
- pThis->UpdateVendorImage();
- pThis->SetUpdateMode( sal_True );
+ get(m_pAlternativesCT, "alternatives");
+ m_pAlternativesCT->init(this);
- return 0;
-};
+ get(m_pReplaceEdit, "replaceed");
+ PushButton *pReplaceBtn = get<PushButton>("replace");
+ m_pReplaceEdit->init(pReplaceBtn);
-// class SvxThesaurusDialog ----------------------------------------------
+ get(m_pLangMBtn, "langcb");
-SvxThesaurusDialog::SvxThesaurusDialog(
- Window* pParent,
- uno::Reference< linguistic2::XThesaurus > xThes,
- const String &rWord,
- LanguageType nLanguage ) :
-
- SvxStandardDialog( pParent, CUI_RES( RID_SVXDLG_THESAURUS ) ),
-
- aVendorImageFI ( this, CUI_RES( IMG_VENDOR ) ),
- aLeftBtn ( this, CUI_RES( BTN_LEFT ) ),
- aWordText ( this, CUI_RES( FT_WORD ) ),
- aWordCB ( this, CUI_RES( CB_WORD ), *this ),
- m_aAlternativesText ( this, CUI_RES( FT_THES_ALTERNATIVES ) ),
- m_pAlternativesCT ( new ThesaurusAlternativesCtrl_Impl( this, *this ) ),
- aReplaceText ( this, CUI_RES( FT_REPL ) ),
- aReplaceEdit ( this, CUI_RES( ED_REPL ) ),
- aFL ( this, CUI_RES( FL_VAR ) ),
- aHelpBtn ( this, CUI_RES( BTN_THES_HELP ) ),
- aLangMBtn ( this, CUI_RES( MB_LANGUAGE ) ),
- aReplaceBtn ( this, CUI_RES( BTN_THES_OK ) ),
- aCancelBtn ( this, CUI_RES( BTN_THES_CANCEL ) ),
- aErrStr ( CUI_RES( STR_ERR_TEXTNOTFOUND ) ),
- aVendorDefaultImage ( CUI_RES( IMG_DEFAULT_VENDOR ) ),
- xThesaurus ( NULL ),
- aLookUpText (),
- nLookUpLanguage ( LANGUAGE_NONE ),
- m_bWordFound( false )
-{
- aReplaceEdit.SetButton( &aReplaceBtn );
-
- aLeftBtn.SetClickHdl( LINK( this, SvxThesaurusDialog, LeftBtnHdl_Impl ) );
- aWordCB.SetSelectHdl( LINK( this, SvxThesaurusDialog, WordSelectHdl_Impl ) );
- aLangMBtn.SetSelectHdl( LINK( this, SvxThesaurusDialog, LanguageHdl_Impl ) );
+ pReplaceBtn->SetClickHdl( LINK( this, SvxThesaurusDialog, ReplaceBtnHdl_Impl ) );
+ m_pLeftBtn->SetClickHdl( LINK( this, SvxThesaurusDialog, LeftBtnHdl_Impl ) );
+ m_pWordCB->SetSelectHdl( LINK( this, SvxThesaurusDialog, WordSelectHdl_Impl ) );
+ m_pLangMBtn->SetSelectHdl( LINK( this, SvxThesaurusDialog, LanguageHdl_Impl ) );
m_pAlternativesCT->SetSelectHdl( LINK( this, SvxThesaurusDialog, AlternativesSelectHdl_Impl ));
m_pAlternativesCT->SetDoubleClickHdl( LINK( this, SvxThesaurusDialog, AlternativesDoubleClickHdl_Impl ));
- Application::PostUserEvent( STATIC_LINK( this, SvxThesaurusDialog, VendorImageInitHdl ) );
-
xThesaurus = xThes;
aLookUpText = OUString( rWord );
nLookUpLanguage = nLanguage;
if (rWord.Len() > 0)
aLookUpHistory.push( rWord );
- FreeResource();
-
OUString aTmp( rWord );
linguistic::RemoveHyphens( aTmp );
linguistic::ReplaceControlChars( aTmp );
String aTmp2( aTmp );
- aReplaceEdit.SetText( aTmp2 );
- aWordCB.InsertEntry( aTmp2 );
+ m_pReplaceEdit->SetText( aTmp2 );
+ m_pWordCB->InsertEntry( aTmp2 );
LookUp( aTmp2 );
m_pAlternativesCT->GrabFocus();
- aLeftBtn.Enable( sal_False );
+ m_pLeftBtn->Enable( sal_False );
// fill language menu button list
SvtLanguageTable aLangTab;
@@ -623,11 +507,11 @@ SvxThesaurusDialog::SvxThesaurusDialog(
aLocales = xThesaurus->getLocales();
const sal_Int32 nLocales = aLocales.getLength();
const lang::Locale *pLocales = aLocales.getConstArray();
- delete aLangMBtn.GetPopupMenu();
- PopupMenu* pMenu = new PopupMenu;
- pMenu->SetMenuFlags( MENU_FLAG_NOAUTOMNEMONICS );
+ PopupMenu* pMenu = m_pLangMBtn->GetPopupMenu();
+ pMenu->Clear();
+ pMenu->SetMenuFlags(MENU_FLAG_NOAUTOMNEMONICS);
std::vector< OUString > aLangVec;
- for (sal_Int32 i = 0; i < nLocales; ++i )
+ for (sal_Int32 i = 0; i < nLocales; ++i)
{
const LanguageType nLang = SvxLocaleToLanguage( pLocales[i] );
DBG_ASSERT( nLang != LANGUAGE_NONE && nLang != LANGUAGE_DONTKNOW, "failed to get language" );
@@ -636,18 +520,29 @@ SvxThesaurusDialog::SvxThesaurusDialog(
std::sort( aLangVec.begin(), aLangVec.end() );
for (size_t i = 0; i < aLangVec.size(); ++i)
pMenu->InsertItem( (sal_uInt16)i+1, aLangVec[i] ); // menu items should be enumerated from 1 and not 0
- aLangMBtn.SetPopupMenu( pMenu );
- SetWindowTitle( nLanguage );
+ std::vector< OUString >::iterator aI = std::find(aLangVec.begin(), aLangVec.end(), aLangTab.GetString(nLanguage));
+ if (aI != aLangVec.end())
+ {
+ pMenu->SetSelectedEntry(std::distance(aLangVec.begin(), aI) + 1);
+ pMenu->Select();
+ }
+
+ SetWindowTitle(nLanguage);
// disable controls if service is missing
if (!xThesaurus.is())
Enable( sal_False );
}
+IMPL_LINK( SvxThesaurusDialog, ReplaceBtnHdl_Impl, Button *, EMPTYARG /*pBtn*/ )
+{
+ EndDialog(true);
+ return 0;
+}
+
SvxThesaurusDialog::~SvxThesaurusDialog()
{
- delete aLangMBtn.GetPopupMenu();
}
void SvxThesaurusDialog::SetWindowTitle( LanguageType nLanguage )
@@ -663,7 +558,7 @@ void SvxThesaurusDialog::SetWindowTitle( LanguageType nLanguage )
String SvxThesaurusDialog::GetWord()
{
- return aReplaceEdit.GetText();
+ return m_pReplaceEdit->GetText();
}
sal_uInt16 SvxThesaurusDialog::GetLanguage() const
diff --git a/cui/source/dialogs/thesdlg.hrc b/cui/source/dialogs/thesdlg.hrc
deleted file mode 100644
index 56c6333..0000000
--- a/cui/source/dialogs/thesdlg.hrc
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * 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 _SVX_THESDLG_HRC
-#define _SVX_THESDLG_HRC
-
-// defines ---------------------------------------------------------------
-
-#define BTN_LEFT 9
-#define BTN_THES_OK 10
-#define BTN_THES_CANCEL 11
-#define MB_LANGUAGE 12
-#define BTN_THES_HELP 13
-#define FT_WORD 15
-#define CB_WORD 16
-#define FT_REPL 21
-#define ED_REPL 22
-#define FL_VAR 23
-#define FT_THES_ALTERNATIVES 24
-#define CT_THES_ALTERNATIVES 25
-#define IMG_VENDOR 26
-#define IMG_DEFAULT_VENDOR 27
-
-#define STR_ERR_TEXTNOTFOUND 101
-
-#endif
diff --git a/cui/source/dialogs/thesdlg.src b/cui/source/dialogs/thesdlg.src
deleted file mode 100644
index 67fdced..0000000
--- a/cui/source/dialogs/thesdlg.src
+++ /dev/null
@@ -1,146 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#include "cuires.hrc"
-#include "thesdlg.hrc"
-#include "helpid.hrc"
-#include <svx/svxids.hrc> // SID_THESAURUS
-
-
- // RID_SVXDLG_THES -------------------------------------------------------
-ModalDialog RID_SVXDLG_THESAURUS
-{
- HelpId = CMD_SID_THESAURUS ;
- OutputSize = TRUE ;
- Size = MAP_APPFONT ( 235, 230 ) ;
- Text [ en-US ] = "Thesaurus" ;
- SvLook = TRUE ;
- Moveable = TRUE ;
-
- FixedImage IMG_VENDOR
- {
- Pos = MAP_APPFONT ( 0, 0 ) ;
- Size = MAP_APPFONT ( 235, 0 ) ; // correct size will be applied at runtime
- Hide = TRUE;
- };
-
- ImageButton BTN_LEFT
- {
- HelpID = "cui:ImageButton:RID_SVXDLG_THESAURUS:BTN_LEFT";
- Pos = MAP_APPFONT ( 5 , 15 ) ;
- Size = MAP_APPFONT ( 14 , 14 ) ;
- TABSTOP = TRUE ;
- SYMBOL = IMAGEBUTTON_ARROW_LEFT ;
- };
- FixedText FT_WORD
- {
- Pos = MAP_APPFONT ( 24 , 5 ) ;
- Size = MAP_APPFONT ( 143 , 8 ) ;
- Text [ en-US ] = "~Current word" ;
- LEFT = TRUE ;
- };
- ComboBox CB_WORD
- {
- HelpID = "cui:ComboBox:RID_SVXDLG_THESAURUS:CB_WORD";
- DropDown = TRUE ;
- Pos = MAP_APPFONT ( 24 , 16 ) ;
- Size = MAP_APPFONT ( 141 , 60 ) ; // have drop down space for several lines
- };
- MenuButton MB_LANGUAGE
- {
- HelpID = "cui:MenuButton:RID_SVXDLG_THESAURUS:MB_LANGUAGE";
- Pos = MAP_APPFONT ( 170 , 16 ) ;
- Size = MAP_APPFONT ( 60 , 14 ) ;
- Text [ en-US ] = "~Language" ;
- };
-
- FixedText FT_THES_ALTERNATIVES
- {
- Pos = MAP_APPFONT ( 5 , 33 ) ;
- Size = MAP_APPFONT ( 255 , 8 ) ;
- Text [ en-US ] = "~Alternatives" ;
- LEFT = TRUE ;
- };
- Control CT_THES_ALTERNATIVES
- {
- HelpID = HID_CT_THES_ALTERNATIVES ; // also needed for automatic testing to find the control
- Pos = MAP_APPFONT ( 5 , 45 ) ;
- Size = MAP_APPFONT ( 225 , 121 ) ;
- Border = TRUE;
- TabStop = TRUE ;
- };
-
- FixedText FT_REPL
- {
- Pos = MAP_APPFONT ( 5 , 173 ) ;
- Size = MAP_APPFONT ( 255 , 8 ) ;
- Text [ en-US ] = "~Replace with" ;
- LEFT = TRUE ;
- };
- Edit ED_REPL
- {
- HelpID = "cui:Edit:RID_SVXDLG_THESAURUS:ED_REPL";
- BORDER = TRUE ;
- Pos = MAP_APPFONT ( 5 , 184 ) ;
- Size = MAP_APPFONT ( 225 , 12 ) ;
- LEFT = TRUE ;
- };
- FixedLine FL_VAR
- {
- Pos = MAP_APPFONT ( 0 , 200 ) ;
- Size = MAP_APPFONT ( 235 , 8 ) ;
- };
-
- HelpButton BTN_THES_HELP
- {
- Pos = MAP_APPFONT ( 5 , 210 ) ;
- Size = MAP_APPFONT ( 60 , 14 ) ;
- };
- OkButton BTN_THES_OK
- {
- Pos = MAP_APPFONT ( 105 , 210 ) ;
- Size = MAP_APPFONT ( 60 , 14 ) ;
- Text [ en-US ] = "Replace" ;
- DefButton = TRUE ;
- };
- CancelButton BTN_THES_CANCEL
- {
- Pos = MAP_APPFONT ( 170 , 210 ) ;
- Size = MAP_APPFONT ( 60 , 14 ) ;
- };
-
- String STR_ERR_TEXTNOTFOUND
- {
- Text [ en-US ] = "No alternatives found." ;
- };
-
- Image IMG_DEFAULT_VENDOR
- {
- ImageBitmap = Bitmap { File = "vendor01.png"; };
- };
-};
-
diff --git a/cui/source/dialogs/thesdlg_impl.hxx b/cui/source/dialogs/thesdlg_impl.hxx
index f1c5209..a0c73bb 100644
--- a/cui/source/dialogs/thesdlg_impl.hxx
+++ b/cui/source/dialogs/thesdlg_impl.hxx
@@ -55,14 +55,14 @@ using namespace ::com::sun::star;
using ::rtl::OUString;
class SvLBoxEntry;
-class ThesaurusAlternativesCtrl_Impl;
+class ThesaurusAlternativesCtrl;
-class AlternativesString_Impl : public SvLBoxString
+class AlternativesString : public SvLBoxString
{
- ThesaurusAlternativesCtrl_Impl & m_rControlImpl;
+ ThesaurusAlternativesCtrl& m_rControlImpl;
public:
- AlternativesString_Impl( ThesaurusAlternativesCtrl_Impl &rControl,
+ AlternativesString( ThesaurusAlternativesCtrl &rControl,
SvLBoxEntry* pEntry, sal_uInt16 nFlags, const String& rStr );
virtual void Paint( const Point& rPos, SvLBox& rDev, sal_uInt16 nFlags, SvLBoxEntry* pEntry);
diff --git a/cui/source/inc/cuires.hrc b/cui/source/inc/cuires.hrc
index f9e9571..0899f95 100644
--- a/cui/source/inc/cuires.hrc
+++ b/cui/source/inc/cuires.hrc
@@ -212,7 +212,6 @@
#define RID_SVX_GRFFILTER_DLG_EMBOSS_TAB (RID_SVX_START + 337)
#define RID_SVXDLG_SEARCHATTR (RID_SVX_START + 22)
#define RID_SVXDLG_HYPHENATE (RID_SVX_START + 30)
-#define RID_SVXDLG_THESAURUS (RID_SVX_START + 31)
#define RID_SVXSTR_HMERR_CHECKINSTALL (RID_SVX_START + 94)
// hyperlink dialog
@@ -429,6 +428,8 @@
#define RID_SVXSTR_EVENT_CALCULATE (RID_SVX_START + 1193)
#define RID_SVXSTR_EVENT_CONTENTCHANGED (RID_SVX_START + 1194)
+#define RID_SVXSTR_ERR_TEXTNOTFOUND (RID_SVX_START + 1195)
+
#define RID_SVXDLG_CERTPATH (RID_SVX_START + 1198)
#define RID_CUI_DIALOG_COLORPICKER (RID_SVX_START + 3)
diff --git a/cui/source/inc/helpid.hrc b/cui/source/inc/helpid.hrc
index 169b1ef..432992e 100644
--- a/cui/source/inc/helpid.hrc
+++ b/cui/source/inc/helpid.hrc
@@ -376,7 +376,6 @@
#define HID_OFAPAGE_QUOTE_SW_CLB "CUI_HID_OFAPAGE_QUOTE_SW_CLB"
#define HID_OFAPAGE_QUOTE_CLB "CUI_HID_OFAPAGE_QUOTE_CLB"
#define HID_POSTIT_DIALOG "CUI_HID_POSTIT_DIALOG"
-#define HID_CT_THES_ALTERNATIVES "CUI_HID_CT_THES_ALTERNATIVES"
#define HID_DLG_PASSWORD_TO_OPEN_MODIFY "CUI_HID_DLG_PASSWORD_TO_OPEN_MODIFY"
#define HID_DLG_PASSWORD_TO_OPEN_MODIFY_PASSWORD_TO_OPEN "CUI_HID_DLG_PASSWORD_TO_OPEN_MODIFY_PASSWORD_TO_OPEN"
diff --git a/cui/source/inc/thesdlg.hxx b/cui/source/inc/thesdlg.hxx
index 8809c5a..c6b43a6 100644
--- a/cui/source/inc/thesdlg.hxx
+++ b/cui/source/inc/thesdlg.hxx
@@ -35,24 +35,23 @@ using namespace ::com::sun::star;
class SvxThesaurusDialog;
-class LookUpComboBox_Impl : public ComboBox
+class LookUpComboBox : public ComboBox
{
Timer m_aModifyTimer;
Selection m_aSelection;
- Button * m_pBtn;
- SvxThesaurusDialog& m_rDialogImpl;
+ SvxThesaurusDialog* m_pDialog;
/// disable copy ctor and assignment operator
- LookUpComboBox_Impl( const LookUpComboBox_Impl & );
- LookUpComboBox_Impl & operator = ( const LookUpComboBox_Impl & );
+ LookUpComboBox( const LookUpComboBox & );
+ LookUpComboBox& operator = ( const LookUpComboBox & );
public:
- LookUpComboBox_Impl( Window *pParent, const ResId &rResId, SvxThesaurusDialog &rImpl );
- virtual ~LookUpComboBox_Impl();
+ LookUpComboBox(Window *pParent);
+ virtual ~LookUpComboBox();
DECL_LINK( ModifyTimer_Hdl, Timer * );
- void SetButton( Button *pBtn ) { m_pBtn = pBtn; }
+ void init(SvxThesaurusDialog *pDialog);
// ComboBox
virtual void Modify();
@@ -75,21 +74,23 @@ public:
const String& GetText() const { return sText; }
};
-class ThesaurusAlternativesCtrl_Impl :
- public SvxCheckListBox
+class ThesaurusAlternativesCtrl
+ : public SvxCheckListBox
{
- SvxThesaurusDialog& m_rDialogImpl;
+ SvxThesaurusDialog* m_pDialog;
typedef std::map< const SvLBoxEntry *, AlternativesExtraData > UserDataMap_t;
UserDataMap_t m_aUserData;
/// disable copy ctor and assignment operator
- ThesaurusAlternativesCtrl_Impl( const ThesaurusAlternativesCtrl_Impl & );
- ThesaurusAlternativesCtrl_Impl & operator = ( const ThesaurusAlternativesCtrl_Impl & );
+ ThesaurusAlternativesCtrl( const ThesaurusAlternativesCtrl & );
+ ThesaurusAlternativesCtrl & operator = ( const ThesaurusAlternativesCtrl & );
public:
- ThesaurusAlternativesCtrl_Impl( Window* pParent, SvxThesaurusDialog &rImpl );
- virtual ~ThesaurusAlternativesCtrl_Impl();
+ ThesaurusAlternativesCtrl(Window* pParent);
+
+ void init(SvxThesaurusDialog *pDialog);
+ virtual ~ThesaurusAlternativesCtrl();
SvLBoxEntry * AddEntry( sal_Int32 nVal, const String &rText, bool bIsHeader );
@@ -102,19 +103,19 @@ public:
virtual void Paint( const Rectangle& rRect );
};
-class ReplaceEdit_Impl : public Edit
+class ReplaceEdit : public Edit
{
Button * m_pBtn;
/// disable copy ctor and assignment operator
- ReplaceEdit_Impl( const ReplaceEdit_Impl & );
- ReplaceEdit_Impl & operator = ( const ReplaceEdit_Impl & );
+ ReplaceEdit( const ReplaceEdit & );
+ ReplaceEdit & operator = ( const ReplaceEdit & );
public:
- ReplaceEdit_Impl( Window *pParent, const ResId &rResId );
- virtual ~ReplaceEdit_Impl();
+ ReplaceEdit(Window *pParent);
+ virtual ~ReplaceEdit();
- void SetButton( Button *pBtn ) { m_pBtn = pBtn; }
+ void init(Button *pBtn) { m_pBtn = pBtn; }
// Edit
virtual void Modify();
@@ -124,22 +125,13 @@ public:
class SvxThesaurusDialog : public SvxStandardDialog
{
- FixedImage aVendorImageFI;
- ImageButton aLeftBtn;
- FixedText aWordText;
- LookUpComboBox_Impl aWordCB;
- FixedText m_aAlternativesText;
- boost::shared_ptr< ThesaurusAlternativesCtrl_Impl > m_pAlternativesCT;
- FixedText aReplaceText;
- ReplaceEdit_Impl aReplaceEdit;
- FixedLine aFL;
- HelpButton aHelpBtn;
- MenuButton aLangMBtn;
- OKButton aReplaceBtn;
- CancelButton aCancelBtn;
-
- String aErrStr;
- Image aVendorDefaultImage;
+ PushButton* m_pLeftBtn;
+ LookUpComboBox* m_pWordCB;
+ ThesaurusAlternativesCtrl* m_pAlternativesCT;
+ ReplaceEdit* m_pReplaceEdit;
+ MenuButton* m_pLangMBtn;
+
+ OUString m_aErrStr;
uno::Reference< linguistic2::XThesaurus > xThesaurus;
OUString aLookUpText;
@@ -149,9 +141,10 @@ class SvxThesaurusDialog : public SvxStandardDialog
public:
bool WordFound() const { return m_bWordFound; }
- OUString getErrStr() const { return aErrStr; }
+ OUString getErrStr() const { return m_aErrStr; }
// Handler
+ DECL_LINK( ReplaceBtnHdl_Impl, Button * );
DECL_LINK( LeftBtnHdl_Impl, Button * );
DECL_LINK( LanguageHdl_Impl, MenuButton * );
DECL_LINK( LookUpHdl_Impl, Button * );
@@ -160,13 +153,11 @@ public:
DECL_LINK( AlternativesDoubleClickHdl_Impl, SvxCheckListBox * );
DECL_STATIC_LINK( SvxThesaurusDialog, SelectFirstHdl_Impl, SvxCheckListBox * );
- DECL_STATIC_LINK( SvxThesaurusDialog, VendorImageInitHdl, SvxThesaurusDialog * );
uno::Sequence< uno::Reference< linguistic2::XMeaning > >
queryMeanings_Impl( ::rtl::OUString& rTerm, const lang::Locale& rLocale, const beans::PropertyValues& rProperties ) throw(lang::IllegalArgumentException, uno::RuntimeException);
bool UpdateAlternativesBox_Impl();
- void UpdateVendorImage();
void LookUp( const String &rText );
void LookUp_Impl();
virtual void Apply();
diff --git a/cui/uiconfig/ui/thesaurus.ui b/cui/uiconfig/ui/thesaurus.ui
new file mode 100644
index 0000000..8df35d0
--- /dev/null
+++ b/cui/uiconfig/ui/thesaurus.ui
@@ -0,0 +1,217 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+ <!-- interface-requires gtk+ 3.0 -->
+ <object class="GtkDialog" id="ThesaurusDialog">
+ <property name="can_focus">False</property>
+ <property name="border_width">5</property>
+ <property name="title" translatable="yes">Thesaurus</property>
+ <property name="type_hint">dialog</property>
+ <child internal-child="vbox">
+ <object class="GtkBox" id="dialog-vbox1">
+ <property name="can_focus">False</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">2</property>
+ <child internal-child="action_area">
+ <object class="GtkButtonBox" id="dialog-action_area1">
+ <property name="can_focus">False</property>
+ <property name="layout_style">end</property>
+ <child>
+ <object class="GtkButton" id="help">
+ <property name="label">gtk-help</property>
+ <property name="use_action_appearance">False</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="use_action_appearance">False</property>
+ <property name="use_stock">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="replace">
+ <property name="label" translatable="yes">Replace</property>
+ <property name="use_action_appearance">False</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="has_default">True</property>
+ <property name="receives_default">True</property>
+ <property name="use_action_appearance">False</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="cancel">
+ <property name="label">gtk-cancel</property>
+ <property name="use_action_appearance">False</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="use_action_appearance">False</property>
+ <property name="use_stock">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="pack_type">end</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkGrid" id="grid1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="row_spacing">6</property>
+ <property name="column_spacing">6</property>
+ <child>
+ <object class="GtkLabel" id="label1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Current word</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">0</property>
+ <property name="width">2</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <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">Alternatives</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">2</property>
+ <property name="width">3</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label3">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Replace with</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">4</property>
+ <property name="width">3</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="cuilo:ReplaceEdit" id="replaceed">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="invisible_char">â</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">5</property>
+ <property name="width">3</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="cuilo:LookUpComboBox" id="wordcb">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="hexpand">True</property>
+ <property name="entry_text_column">0</property>
+ <property name="id_column">1</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">1</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="left">
+ <property name="use_action_appearance">False</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="halign">start</property>
+ <property name="use_action_appearance">False</property>
+ <property name="image">image1</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>
+ <child>
+ <object class="GtkComboBoxText" id="langcb">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ </object>
+ <packing>
+ <property name="left_attach">2</property>
+ <property name="top_attach">1</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="cuilo:ThesaurusAlternativesCtrl" id="alternatives">
+ <property name="width_request">500</property>
+ <property name="height_request">300</property>
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">label</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">3</property>
+ <property name="width">3</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ <action-widgets>
+ <action-widget response="0">help</action-widget>
+ <action-widget response="0">replace</action-widget>
+ <action-widget response="0">cancel</action-widget>
+ </action-widgets>
+ </object>
+ <object class="GtkImage" id="image1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="stock">gtk-go-back</property>
+ </object>
+</interface>
commit c5850f4b25d2b735ea59bb0ac8c2bc58527ac17e
Author: Caolán McNamara <caolanm at redhat.com>
Date: Thu Oct 4 11:19:15 2012 +0100
Use MenuButton for non-editable GtkComboBoxText instead of ComboBox
its more similar for the non-editable list. Requires some love
to MenuButton to reflect the selected entry and resize appropiately
Change-Id: I4b37931e35a5f326d6fd4e445eb741bece6b55a6
diff --git a/sw/uiconfig/swriter/ui/charurlpage.ui b/sw/uiconfig/swriter/ui/charurlpage.ui
index 81534e3..794212a 100644
--- a/sw/uiconfig/swriter/ui/charurlpage.ui
+++ b/sw/uiconfig/swriter/ui/charurlpage.ui
@@ -96,20 +96,6 @@
</packing>
</child>
<child>
- <object class="GtkComboBoxText" id="targetfrmlb">
- <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">1</property>
- <property name="top_attach">3</property>
- <property name="width">1</property>
- <property name="height">1</property>
- </packing>
- </child>
- <child>
<object class="GtkEntry" id="urled">
<property name="visible">True</property>
<property name="can_focus">True</property>
@@ -183,6 +169,26 @@
<child>
<placeholder/>
</child>
+ <child>
+ <object class="GtkComboBoxText" id="targetfrmlb">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="has_entry">True</property>
+ <property name="entry_text_column">0</property>
+ <property name="id_column">1</property>
+ <child internal-child="entry">
+ <object class="GtkEntry" id="comboboxtext-entry">
+ <property name="can_focus">False</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">3</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
</object>
</child>
</object>
diff --git a/vcl/inc/vcl/menu.hxx b/vcl/inc/vcl/menu.hxx
index cd931c7..e908119 100644
--- a/vcl/inc/vcl/menu.hxx
+++ b/vcl/inc/vcl/menu.hxx
@@ -126,6 +126,7 @@ class VCL_DLLPUBLIC Menu : public Resource
{
friend class MenuBar;
friend class MenuBarWindow;
+ friend class MenuButton;
friend class MenuFloatingWindow;
friend class PopupMenu;
friend class SystemWindow;
diff --git a/vcl/inc/vcl/menubtn.hxx b/vcl/inc/vcl/menubtn.hxx
index c9906c9..02e2f5d 100644
--- a/vcl/inc/vcl/menubtn.hxx
+++ b/vcl/inc/vcl/menubtn.hxx
@@ -35,6 +35,8 @@
class Timer;
class PopupMenu;
+class VclBuilder;
+class VclSimpleEvent;
// --------------------
// - MenuButton-Types -
@@ -49,12 +51,15 @@ class PopupMenu;
class VCL_DLLPUBLIC MenuButton : public PushButton
{
private:
+ friend class VclBuilder;
+
Rectangle maFocusRect;
Timer* mpMenuTimer;
PopupMenu* mpOwnMenu;
PopupMenu* mpMenu;
- sal_uInt16 mnCurItemId;
- sal_uInt16 mnMenuMode;
+ sal_uInt16 mnCurItemId;
+ sal_uInt16 mnMenuMode;
+ bool mbDisplaySelectedItem;
Link maActivateHdl;
Link maSelectHdl;
@@ -62,10 +67,14 @@ private:
SAL_DLLPRIVATE void ImplExecuteMenu();
DECL_DLLPRIVATE_LINK( ImplMenuTimeoutHdl, void* );
+ SAL_DLLPRIVATE void updateText();
+
// Copy assignment is forbidden and not implemented.
SAL_DLLPRIVATE MenuButton( const MenuButton & );
SAL_DLLPRIVATE MenuButton& operator=( const MenuButton & );
+ DECL_LINK(MenuEventListener, VclSimpleEvent*);
+
protected:
using Window::ImplInit;
SAL_DLLPRIVATE void ImplInit( Window* pParent, WinBits nStyle );
@@ -95,6 +104,10 @@ public:
const Link& GetActivateHdl() const { return maActivateHdl; }
void SetSelectHdl( const Link& rLink ) { maSelectHdl = rLink; }
const Link& GetSelectHdl() const { return maSelectHdl; }
+
+ void SetShowDisplaySelectedItem(bool bShow);
+
+ virtual Size GetOptimalSize(WindowSizeType eType) const;
};
#endif // _SV_MENUBTN_HXX
diff --git a/vcl/source/control/menubtn.cxx b/vcl/source/control/menubtn.cxx
index acc7e9a..2d40192 100644
--- a/vcl/source/control/menubtn.cxx
+++ b/vcl/source/control/menubtn.cxx
@@ -84,8 +84,9 @@ void MenuButton::ImplExecuteMenu()
// -----------------------------------------------------------------------
-MenuButton::MenuButton( Window* pParent, WinBits nWinBits ) :
- PushButton( WINDOW_MENUBUTTON )
+MenuButton::MenuButton( Window* pParent, WinBits nWinBits )
+ : PushButton( WINDOW_MENUBUTTON )
+ , mbDisplaySelectedItem(false)
{
ImplInitMenuButtonData();
ImplInit( pParent, nWinBits );
@@ -93,8 +94,9 @@ MenuButton::MenuButton( Window* pParent, WinBits nWinBits ) :
// -----------------------------------------------------------------------
-MenuButton::MenuButton( Window* pParent, const ResId& rResId ) :
- PushButton( WINDOW_MENUBUTTON )
+MenuButton::MenuButton( Window* pParent, const ResId& rResId )
+ : PushButton( WINDOW_MENUBUTTON )
+ , mbDisplaySelectedItem(false)
{
ImplInitMenuButtonData();
rResId.SetRT( RSC_MENUBUTTON );
@@ -127,6 +129,8 @@ void MenuButton::ImplLoadRes( const ResId& rResId )
MenuButton::~MenuButton()
{
delete mpMenuTimer;
+ if (mbDisplaySelectedItem && mpMenu)
+ mpMenu->RemoveEventListener(LINK(this, MenuButton, MenuEventListener));
delete mpOwnMenu;
}
@@ -208,9 +212,33 @@ void MenuButton::Activate()
void MenuButton::Select()
{
+ updateText();
maSelectHdl.Call( this );
}
+void MenuButton::updateText()
+{
+ if (mbDisplaySelectedItem)
+ {
+ if (mpMenu)
+ SetText(mpMenu->GetItemText(mpMenu->GetCurItemId()));
+ else
+ SetText(OUString());
+ }
+}
+
+Size MenuButton::GetOptimalSize(WindowSizeType eType) const
+{
+ Size aRet = PushButton::GetOptimalSize(eType);
+ if (mbDisplaySelectedItem && mpMenu)
+ {
+ Size aMenuSize(mpMenu->ImplCalcSize(const_cast<MenuButton*>(this)));
+ if (aMenuSize.Width() > aRet.Width())
+ aRet.Width() = aMenuSize.Width();
+ }
+ return aRet;
+}
+
// -----------------------------------------------------------------------
void MenuButton::SetMenuMode( sal_uInt16 nMode )
@@ -220,13 +248,52 @@ void MenuButton::SetMenuMode( sal_uInt16 nMode )
mnMenuMode = nMode;
}
-// -----------------------------------------------------------------------
+void MenuButton::SetShowDisplaySelectedItem(bool bShow)
+{
+ if (mbDisplaySelectedItem == bShow)
+ return;
+ if (mbDisplaySelectedItem && mpMenu)
+ mpMenu->RemoveEventListener(LINK(this, MenuButton, MenuEventListener));
+ mbDisplaySelectedItem = bShow;
+ if (mbDisplaySelectedItem && mpMenu)
+ mpMenu->AddEventListener(LINK(this, MenuButton, MenuEventListener));
+}
void MenuButton::SetPopupMenu( PopupMenu* pNewMenu )
{
+ if (pNewMenu == mpMenu)
+ return;
+ if (mbDisplaySelectedItem && mpMenu)
+ mpMenu->RemoveEventListener(LINK(this, MenuButton, MenuEventListener));
// Fuer die 5.1-Auslieferung besser noch nicht inline, ansonsten kann
// diese Funktion zur 6.0 inline werden
mpMenu = pNewMenu;
+ updateText();
+ if (mbDisplaySelectedItem && mpMenu)
+ mpMenu->AddEventListener(LINK(this, MenuButton, MenuEventListener));
+}
+
+IMPL_LINK(MenuButton, MenuEventListener, VclSimpleEvent*, pEvent)
+{
+ if (pEvent && pEvent->ISA(VclMenuEvent))
+ {
+ VclMenuEvent* pMenuEvent = (VclMenuEvent*)pEvent;
+ if (pMenuEvent->GetMenu() == mpMenu)
+ {
+ switch (pMenuEvent->GetId())
+ {
+ case VCLEVENT_MENU_INSERTITEM:
+ case VCLEVENT_MENU_REMOVEITEM:
+ case VCLEVENT_MENU_ITEMTEXTCHANGED:
+ queue_resize();
+ break;
+ case VCLEVENT_MENU_SELECT:
+ updateText();
+ break;
+ }
+ }
+ }
+ return 0;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx
index 63fce39..3ef8289 100644
--- a/vcl/source/window/builder.cxx
+++ b/vcl/source/window/builder.cxx
@@ -17,6 +17,7 @@
#include <vcl/fixed.hxx>
#include <vcl/layout.hxx>
#include <vcl/lstbox.hxx>
+#include <vcl/menubtn.hxx>
#include <vcl/svapp.hxx>
#include <vcl/tabctrl.hxx>
#include <vcl/tabpage.hxx>
@@ -242,7 +243,7 @@ namespace
bool extractResizable(VclBuilder::stringmap &rMap)
{
bool bResizable = true;
- VclBuilder::stringmap::iterator aFind = rMap.find(OString(RTL_CONSTASCII_STRINGPARAM("resizable")));
+ VclBuilder::stringmap::iterator aFind = rMap.find(OString("resizable"));
if (aFind != rMap.end())
{
bResizable = toBool(aFind->second);
@@ -251,10 +252,22 @@ namespace
return bResizable;
}
+ bool extractEntry(VclBuilder::stringmap &rMap)
+ {
+ bool bHasEntry = false;
+ VclBuilder::stringmap::iterator aFind = rMap.find(OString("has-entry"));
+ if (aFind != rMap.end())
+ {
+ bHasEntry = toBool(aFind->second);
+ rMap.erase(aFind);
+ }
+ return bHasEntry;
+ }
+
bool extractOrientation(VclBuilder::stringmap &rMap)
{
bool bVertical = false;
- VclBuilder::stringmap::iterator aFind = rMap.find(OString(RTL_CONSTASCII_STRINGPARAM("orientation")));
+ VclBuilder::stringmap::iterator aFind = rMap.find(OString("orientation"));
if (aFind != rMap.end())
{
bVertical = aFind->second.equalsIgnoreAsciiCaseL(RTL_CONSTASCII_STRINGPARAM("vertical"));
@@ -597,9 +610,20 @@ Window *VclBuilder::makeObject(Window *pParent, const OString &name, const OStri
else if (name.equalsL(RTL_CONSTASCII_STRINGPARAM("GtkComboBoxText")))
{
extractModel(id, rMap);
- ComboBox* pComboBox = new ComboBox(pParent, WB_LEFT|WB_DROPDOWN|WB_VCENTER|WB_3DLOOK);
- pComboBox->SetBestDropDownLineCount();
- pWindow = pComboBox;
+ if (extractEntry(rMap))
+ {
+ ComboBox* pComboBox = new ComboBox(pParent, WB_LEFT|WB_DROPDOWN|WB_VCENTER|WB_3DLOOK);
+ pComboBox->SetBestDropDownLineCount();
+ pWindow = pComboBox;
+ }
+ else
+ {
+ MenuButton *pMenuButton = new MenuButton(pParent, WB_LEFT|WB_VCENTER|WB_3DLOOK);
+ pMenuButton->mpOwnMenu = new PopupMenu; //this now belongs to the menubutton
+ pMenuButton->SetPopupMenu(pMenuButton->mpOwnMenu);
+ pMenuButton->SetShowDisplaySelectedItem(true);
+ pWindow = pMenuButton;
+ }
}
else if (name.equalsL(RTL_CONSTASCII_STRINGPARAM("GtkTreeView")))
{
commit d3b7a3acb481ef530094296eb4461dd343270879
Author: Caolán McNamara <caolanm at redhat.com>
Date: Thu Oct 4 10:11:55 2012 +0100
support system dicts named using bcp47 scheme
but fallback to LANG_REGION on failure
Change-Id: Ic31ba142209cdea1565adef2b592fd59111d9162
diff --git a/lingucomponent/source/lingutil/lingutil.cxx b/lingucomponent/source/lingutil/lingutil.cxx
index 362ede9..6259097 100644
--- a/lingucomponent/source/lingutil/lingutil.cxx
+++ b/lingucomponent/source/lingutil/lingutil.cxx
@@ -35,6 +35,7 @@
#include <osl/file.hxx>
#include <tools/debug.hxx>
#include <tools/urlobj.hxx>
+#include <i18npool/languagetag.hxx>
#include <i18npool/mslangid.hxx>
#include <unotools/lingucfg.hxx>
#include <unotools/pathoptions.hxx>
@@ -150,55 +151,65 @@ std::vector< SvtLinguConfigDictionaryEntry > GetOldStyleDics( const char *pDicTy
// set of languages to remember the language where it is already
// decided to make use of the dictionary.
- std::set< LanguageType > aDicLangInUse;
+ std::set< OUString > aDicLangInUse;
#ifdef SYSTEM_DICTS
- osl::Directory aSystemDicts(aSystemDir);
- if (aSystemDicts.open() == osl::FileBase::E_None)
- {
- osl::DirectoryItem aItem;
- osl::FileStatus aFileStatus(osl_FileStatus_Mask_FileURL);
- while (aSystemDicts.getNextItem(aItem) == osl::FileBase::E_None)
- {
- aItem.getFileStatus(aFileStatus);
- rtl::OUString sPath = aFileStatus.getFileURL();
- if (sPath.lastIndexOf(aSystemSuffix) == sPath.getLength()-aSystemSuffix.getLength())
- {
- sal_Int32 nStartIndex = sPath.lastIndexOf(sal_Unicode('/')) + 1;
- if (!sPath.match(aSystemPrefix, nStartIndex))
- continue;
- rtl::OUString sChunk = sPath.copy(0, sPath.getLength() - aSystemSuffix.getLength());
- sal_Int32 nIndex = nStartIndex + aSystemPrefix.getLength();
- rtl::OUString sLang = sChunk.getToken( 0, '_', nIndex );
- if (!sLang.getLength())
- continue;
- rtl::OUString sRegion;
- if (nIndex != -1)
- sRegion = sChunk.copy( nIndex, sChunk.getLength() - nIndex );
-
- // Thus we first get the language of the dictionary
- LanguageType nLang = MsLangId::convertIsoNamesToLanguage(
- sLang, sRegion );
-
- if (aDicLangInUse.count( nLang ) == 0)
- {
- // remember the new language in use
- aDicLangInUse.insert( nLang );
-
- // add the dictionary to the resulting vector
- SvtLinguConfigDictionaryEntry aDicEntry;
- aDicEntry.aLocations.realloc(1);
- aDicEntry.aLocaleNames.realloc(1);
- rtl::OUString aLocaleName( MsLangId::convertLanguageToIsoString( nLang ) );
- aDicEntry.aLocations[0] = sPath;
- aDicEntry.aFormatName = aFormatName;
- aDicEntry.aLocaleNames[0] = aLocaleName;
- aRes.push_back( aDicEntry );
- }
- }
- }
+ osl::Directory aSystemDicts(aSystemDir);
+ if (aSystemDicts.open() == osl::FileBase::E_None)
+ {
+ osl::DirectoryItem aItem;
+ osl::FileStatus aFileStatus(osl_FileStatus_Mask_FileURL);
+ while (aSystemDicts.getNextItem(aItem) == osl::FileBase::E_None)
+ {
+ aItem.getFileStatus(aFileStatus);
+ OUString sPath = aFileStatus.getFileURL();
+ if (sPath.lastIndexOf(aSystemSuffix) == sPath.getLength()-aSystemSuffix.getLength())
+ {
+ sal_Int32 nStartIndex = sPath.lastIndexOf(sal_Unicode('/')) + 1;
+ if (!sPath.match(aSystemPrefix, nStartIndex))
+ continue;
+ OUString sChunk = sPath.copy(nStartIndex + aSystemPrefix.getLength(),
+ sPath.getLength() - aSystemSuffix.getLength() -
+ nStartIndex - aSystemPrefix.getLength());
+ if (sChunk.isEmpty())
+ continue;
+ //We prefer (now) to use language tags
+ LanguageTag aLangTag(sChunk, true);
+ //On failure try older basic LANG_REGION scheme
+ if (!aLangTag.isValidBcp47())
+ {
+ sal_Int32 nIndex = 0;
+ OUString sLang = sChunk.getToken(0, '_', nIndex);
+ if (!sLang.getLength())
+ continue;
+ OUString sRegion;
+ if (nIndex != -1)
+ sRegion = sChunk.copy(nIndex);
+ aLangTag = LanguageTag(sLang, sRegion);
+ }
+ if (!aLangTag.isValidBcp47())
+ continue;
+
+ // Thus we first get the language of the dictionary
+ OUString aLocaleName(aLangTag.getBcp47());
+
+ if (aDicLangInUse.count(aLocaleName) == 0)
+ {
+ // remember the new language in use
+ aDicLangInUse.insert(aLocaleName);
+
+ // add the dictionary to the resulting vector
+ SvtLinguConfigDictionaryEntry aDicEntry;
+ aDicEntry.aLocations.realloc(1);
+ aDicEntry.aLocaleNames.realloc(1);
+ aDicEntry.aLocations[0] = sPath;
+ aDicEntry.aFormatName = aFormatName;
+ aDicEntry.aLocaleNames[0] = aLocaleName;
+ aRes.push_back( aDicEntry );
+ }
+ }
+ }
}
-
#endif
return aRes;
commit 96e353491215fd2b703f2cd48959176f3e401043
Author: Caolán McNamara <caolanm at redhat.com>
Date: Wed Oct 3 20:56:17 2012 +0100
Show lang-tag instead of Unknown for languages without unknown name
Change-Id: I8e7bb96ecdc6d6edf38401394209b62b01af6784
diff --git a/svtools/source/misc/langtab.cxx b/svtools/source/misc/langtab.cxx
index 92c91a6..f66ea6c 100644
--- a/svtools/source/misc/langtab.cxx
+++ b/svtools/source/misc/langtab.cxx
@@ -34,6 +34,7 @@
#include <i18npool/lang.h>
#include <i18npool/mslangid.hxx>
+#include <i18npool/languagetag.hxx>
#include <svtools/svtools.hrc>
#include <svtools/svtresid.hxx>
@@ -149,19 +150,14 @@ const rtl::OUString SvtLanguageTable::GetString( const LanguageType eType, bool
if ( RESARRAY_INDEX_NOTFOUND != nPos && nPos < Count() )
return ResStringArray::GetString( nPos );
- else
- {
- // If we knew what a simple "en" should alias to (en_US?) we could
- // generally raise an error.
- OSL_ENSURE(
- eLang == LANGUAGE_ENGLISH, "language entry not found in resource" );
-
- nPos = FindIndex( LANGUAGE_DONTKNOW );
- if ( RESARRAY_INDEX_NOTFOUND != nPos && nPos < Count() )
- return ResStringArray::GetString( nPos );
- }
- return rtl::OUString();
+ //Rather than return a fairly useless "Unknown" name, return a geeky but usable-in-a-pinch lang-tag
+ OUString sLangTag(LanguageTag(eType).getBcp47());
+ SAL_WARN("svtools", "Language: 0x"
+ << std::hex << eType
+ << " with unknown name, so returning lang-tag of: "
+ << sLangTag);
+ return sLangTag;
}
String SvtLanguageTable::GetLanguageString( const LanguageType eType )
commit ddd0e56cd787c2f86e9a154cbb0b4ad09ee40f80
Author: Caolán McNamara <caolanm at redhat.com>
Date: Wed Oct 3 13:03:49 2012 +0100
handle children of deferred dialog better
Change-Id: I86f0a23408c031a99a31cd309defec519a2e91ec
diff --git a/vcl/inc/vcl/builder.hxx b/vcl/inc/vcl/builder.hxx
index 112e293..1910791 100644
--- a/vcl/inc/vcl/builder.hxx
+++ b/vcl/inc/vcl/builder.hxx
@@ -116,6 +116,7 @@ private:
OString m_sID;
OString m_sHelpRoot;
Window *m_pParent;
+ bool m_bToplevelHasDeferredInit;
ParserState *m_pParserState;
Window *get_by_name(OString sID);
diff --git a/vcl/inc/vcl/dialog.hxx b/vcl/inc/vcl/dialog.hxx
index 6316322..107c29d 100644
--- a/vcl/inc/vcl/dialog.hxx
+++ b/vcl/inc/vcl/dialog.hxx
@@ -58,6 +58,7 @@ private:
sal_Bool mbOldSaveBack;
sal_Bool mbInClose;
sal_Bool mbModalMode;
+ bool mbIsDefferedInit;
Timer maLayoutTimer;
SAL_DLLPRIVATE void ImplInitDialogData();
@@ -81,6 +82,7 @@ public:
SAL_DLLPRIVATE sal_Bool IsInClose() const { return mbInClose; }
SAL_DLLPRIVATE bool hasPendingLayout() const { return maLayoutTimer.IsActive(); }
SAL_DLLPRIVATE void doDeferredInit(bool bResizable);
+ SAL_DLLPRIVATE bool isDeferredInit() const { return mbIsDefferedInit; }
protected:
Dialog( WindowType nType );
diff --git a/vcl/source/control/fixed.cxx b/vcl/source/control/fixed.cxx
index a63eb3e..688b699 100644
--- a/vcl/source/control/fixed.cxx
+++ b/vcl/source/control/fixed.cxx
@@ -949,7 +949,7 @@ WinBits FixedImage::ImplInitStyle( WinBits nStyle )
void FixedImage::ImplInitSettings()
{
Window* pParent = GetParent();
- if ( pParent->IsChildTransparentModeEnabled() && !IsControlBackground() )
+ if ( pParent && pParent->IsChildTransparentModeEnabled() && !IsControlBackground() )
{
EnableChildTransparentMode( sal_True );
SetParentClipMode( PARENTCLIPMODE_NOCLIP );
@@ -964,7 +964,7 @@ void FixedImage::ImplInitSettings()
if ( IsControlBackground() )
SetBackground( GetControlBackground() );
- else
+ else if ( pParent )
SetBackground( pParent->GetBackground() );
}
}
diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx
index 67bf871..63fce39 100644
--- a/vcl/source/window/builder.cxx
+++ b/vcl/source/window/builder.cxx
@@ -57,6 +57,8 @@ VclBuilder::VclBuilder(Window *pParent, OUString sUIDir, OUString sUIFile, OStri
, m_pParent(pParent)
, m_pParserState(new ParserState)
{
+ m_bToplevelHasDeferredInit = (pParent && pParent->IsDialog()) ? ((Dialog*)pParent)->isDeferredInit() : false;
+
sal_Int32 nIdx = m_sHelpRoot.lastIndexOf('.');
if (nIdx != -1)
m_sHelpRoot = m_sHelpRoot.copy(0, nIdx);
@@ -685,6 +687,7 @@ Window *VclBuilder::insertObject(Window *pParent, const OString &rClass, const O
{
Dialog *pDialog = (Dialog*)pCurrentChild;
pDialog->doDeferredInit(extractResizable(rMap));
+ m_bToplevelHasDeferredInit = false;
}
if (pCurrentChild->GetHelpId().isEmpty())
{
@@ -696,6 +699,11 @@ Window *VclBuilder::insertObject(Window *pParent, const OString &rClass, const O
}
else
{
+ //if we're being inserting under a toplevel dialog whose init is
+ //deferred due to waiting to encounter it in this .ui, and it hasn't
+ //been seen yet, then make unattached widgets parent-less toplevels
+ if (pParent == m_pParent && m_bToplevelHasDeferredInit)
+ pParent = NULL;
pCurrentChild = makeObject(pParent, rClass, rID, rMap);
}
diff --git a/vcl/source/window/dialog.cxx b/vcl/source/window/dialog.cxx
index da9482c..65a72fb 100644
--- a/vcl/source/window/dialog.cxx
+++ b/vcl/source/window/dialog.cxx
@@ -466,8 +466,9 @@ void Dialog::ImplInitSettings()
// -----------------------------------------------------------------------
-Dialog::Dialog( WindowType nType ) :
- SystemWindow( nType )
+Dialog::Dialog( WindowType nType )
+ : SystemWindow( nType )
+ , mbIsDefferedInit(false)
{
ImplInitDialogData();
}
@@ -514,11 +515,13 @@ void Dialog::doDeferredInit(bool bResizable)
Window *pParent = mpDialogParent;
mpDialogParent = NULL;
ImplInit(pParent, nBits);
+ mbIsDefferedInit = false;
}
Dialog::Dialog(Window* pParent, const rtl::OString& rID, const rtl::OUString& rUIXMLDescription)
: SystemWindow( WINDOW_DIALOG )
, mpDialogParent(pParent) //will be unset in doDeferredInit
+ , mbIsDefferedInit(true)
{
ImplInitDialogData();
m_pUIBuilder = new VclBuilder(this, getUIRootDir(), rUIXMLDescription, rID);
@@ -527,6 +530,7 @@ Dialog::Dialog(Window* pParent, const rtl::OString& rID, const rtl::OUString& rU
Dialog::Dialog(Window* pParent, const rtl::OString& rID, const rtl::OUString& rUIXMLDescription, WindowType nType)
: SystemWindow( nType )
, mpDialogParent(pParent) //will be unset in doDeferredInit
+ , mbIsDefferedInit(true)
{
ImplInitDialogData();
m_pUIBuilder = new VclBuilder(this, getUIRootDir(), rUIXMLDescription, rID);
@@ -535,8 +539,9 @@ Dialog::Dialog(Window* pParent, const rtl::OString& rID, const rtl::OUString& rU
// -----------------------------------------------------------------------
-Dialog::Dialog( Window* pParent, WinBits nStyle ) :
- SystemWindow( WINDOW_DIALOG )
+Dialog::Dialog( Window* pParent, WinBits nStyle )
+ : SystemWindow( WINDOW_DIALOG )
+ , mbIsDefferedInit(false)
{
ImplInitDialogData();
ImplInit( pParent, nStyle );
@@ -544,8 +549,9 @@ Dialog::Dialog( Window* pParent, WinBits nStyle ) :
// -----------------------------------------------------------------------
-Dialog::Dialog( Window* pParent, const ResId& rResId ) :
- SystemWindow( WINDOW_DIALOG )
+Dialog::Dialog( Window* pParent, const ResId& rResId )
+ : SystemWindow( WINDOW_DIALOG )
+ , mbIsDefferedInit(false)
{
ImplInitDialogData();
rResId.SetRT( RSC_DIALOG );
diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx
index 44f1a58..d874d81 100644
--- a/vcl/source/window/window.cxx
+++ b/vcl/source/window/window.cxx
@@ -1039,12 +1039,10 @@ void Window::ImplInsertWindow( Window* pParent )
mpWindowImpl->mpParent = pParent;
mpWindowImpl->mpRealParent = pParent;
- Window* pFrameParent = NULL;
- if (pParent && !mpWindowImpl->mbFrame)
- pFrameParent = pParent->mpWindowImpl->mpFrameWindow;
- if (pFrameParent)
+ if ( pParent && !mpWindowImpl->mbFrame )
{
// search frame window and set window frame data
+ Window* pFrameParent = pParent->mpWindowImpl->mpFrameWindow;
mpWindowImpl->mpFrameData = pFrameParent->mpWindowImpl->mpFrameData;
mpWindowImpl->mpFrame = pFrameParent->mpWindowImpl->mpFrame;
mpWindowImpl->mpFrameWindow = pFrameParent;
commit 7263bfec9a6511fc8f5c79135a7c853156560755
Author: Caolán McNamara <caolanm at redhat.com>
Date: Wed Oct 3 12:24:03 2012 +0100
be more tolerant of temporary frameless parents
Change-Id: I61a52d0f5a5e29d271c84fd7b85d80b7fac2e2ec
diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx
index d874d81..44f1a58 100644
--- a/vcl/source/window/window.cxx
+++ b/vcl/source/window/window.cxx
@@ -1039,10 +1039,12 @@ void Window::ImplInsertWindow( Window* pParent )
mpWindowImpl->mpParent = pParent;
mpWindowImpl->mpRealParent = pParent;
- if ( pParent && !mpWindowImpl->mbFrame )
+ Window* pFrameParent = NULL;
+ if (pParent && !mpWindowImpl->mbFrame)
+ pFrameParent = pParent->mpWindowImpl->mpFrameWindow;
+ if (pFrameParent)
{
// search frame window and set window frame data
- Window* pFrameParent = pParent->mpWindowImpl->mpFrameWindow;
mpWindowImpl->mpFrameData = pFrameParent->mpWindowImpl->mpFrameData;
mpWindowImpl->mpFrame = pFrameParent->mpWindowImpl->mpFrame;
mpWindowImpl->mpFrameWindow = pFrameParent;
commit a06579a77a50de08b6e5b92a35939efc87492ed5
Author: Caolán McNamara <caolanm at redhat.com>
Date: Wed Oct 3 11:41:30 2012 +0100
unroll thesaurus dialog and its pImpl
Change-Id: Ib4f5214ae8a699a0bc6abddf67636c712d7f6846
diff --git a/cui/source/dialogs/thesdlg.cxx b/cui/source/dialogs/thesdlg.cxx
index c8cb1b1..c794b2a 100644
--- a/cui/source/dialogs/thesdlg.cxx
+++ b/cui/source/dialogs/thesdlg.cxx
@@ -66,7 +66,7 @@ using ::rtl::OUString;
// class LookUpComboBox_Impl --------------------------------------------------
LookUpComboBox_Impl::LookUpComboBox_Impl(
- Window *pParent, const ResId &rResId, SvxThesaurusDialog_Impl &rImpl ) :
+ Window *pParent, const ResId &rResId, SvxThesaurusDialog &rImpl ) :
ComboBox (pParent, rResId),
m_rDialogImpl( rImpl )
{
@@ -156,7 +156,7 @@ void AlternativesString_Impl::Paint(
ThesaurusAlternativesCtrl_Impl::ThesaurusAlternativesCtrl_Impl(
Window* pParent,
- SvxThesaurusDialog_Impl &rImpl ) :
+ SvxThesaurusDialog &rImpl ) :
SvxCheckListBox( pParent, CUI_RES( CT_THES_ALTERNATIVES ) ),
m_rDialogImpl( rImpl )
{
@@ -236,64 +236,22 @@ void ThesaurusAlternativesCtrl_Impl::KeyInput( const KeyEvent& rKEvt )
void ThesaurusAlternativesCtrl_Impl::Paint( const Rectangle& rRect )
{
- if (!m_rDialogImpl.m_bWordFound)
+ if (!m_rDialogImpl.WordFound())
{
- Size aTextSize( GetTextWidth( m_rDialogImpl.aErrStr ), GetTextHeight() );
+ Size aTextSize( GetTextWidth( m_rDialogImpl.getErrStr() ), GetTextHeight() );
aTextSize = LogicToPixel( aTextSize );
Point aPos;
aPos.X() += GetSizePixel().Width() / 2 - aTextSize.Width() / 2;
aPos.Y() += GetSizePixel().Height() / 2;
aPos = PixelToLogic( aPos );
- DrawText( aPos, m_rDialogImpl.aErrStr );
+ DrawText( aPos, m_rDialogImpl.getErrStr() );
}
else
SvxCheckListBox::Paint( rRect );
}
-// struct SvxThesaurusDialog_Impl ----------------------------------------
-
-SvxThesaurusDialog_Impl::SvxThesaurusDialog_Impl( SvxThesaurusDialog * pDialog ) :
- m_pDialog ( pDialog ),
- aVendorImageFI ( pDialog, CUI_RES( IMG_VENDOR ) ),
- aLeftBtn ( pDialog, CUI_RES( BTN_LEFT ) ),
- aWordText ( pDialog, CUI_RES( FT_WORD ) ),
- aWordCB ( pDialog, CUI_RES( CB_WORD ), *this ),
- m_aAlternativesText ( pDialog, CUI_RES( FT_THES_ALTERNATIVES ) ),
- m_pAlternativesCT ( new ThesaurusAlternativesCtrl_Impl( pDialog, *this ) ),
- aReplaceText ( pDialog, CUI_RES( FT_REPL ) ),
- aReplaceEdit ( pDialog, CUI_RES( ED_REPL ) ),
- aFL ( pDialog, CUI_RES( FL_VAR ) ),
- aHelpBtn ( pDialog, CUI_RES( BTN_THES_HELP ) ),
- aLangMBtn ( pDialog, CUI_RES( MB_LANGUAGE ) ),
- aReplaceBtn ( pDialog, CUI_RES( BTN_THES_OK ) ),
- aCancelBtn ( pDialog, CUI_RES( BTN_THES_CANCEL ) ),
- aErrStr ( CUI_RES( STR_ERR_TEXTNOTFOUND ) ),
- aVendorDefaultImage ( CUI_RES( IMG_DEFAULT_VENDOR ) ),
- xThesaurus ( NULL ),
- aLookUpText (),
- nLookUpLanguage ( LANGUAGE_NONE ),
- m_bWordFound( false )
-{
- // note: FreeResource must only be called in the c-tor of SvxThesaurusDialog
-
- aReplaceEdit.SetButton( &aReplaceBtn );
-
- aLeftBtn.SetClickHdl( LINK( this, SvxThesaurusDialog_Impl, LeftBtnHdl_Impl ) );
- aWordCB.SetSelectHdl( LINK( this, SvxThesaurusDialog_Impl, WordSelectHdl_Impl ) );
- aLangMBtn.SetSelectHdl( LINK( this, SvxThesaurusDialog_Impl, LanguageHdl_Impl ) );
- m_pAlternativesCT->SetSelectHdl( LINK( this, SvxThesaurusDialog_Impl, AlternativesSelectHdl_Impl ));
- m_pAlternativesCT->SetDoubleClickHdl( LINK( this, SvxThesaurusDialog_Impl, AlternativesDoubleClickHdl_Impl ));
-
- Application::PostUserEvent( STATIC_LINK( this, SvxThesaurusDialog_Impl, VendorImageInitHdl ) );
-}
-
-SvxThesaurusDialog_Impl::~SvxThesaurusDialog_Impl()
-{
- delete aLangMBtn.GetPopupMenu();
-}
-
-uno::Sequence< uno::Reference< linguistic2::XMeaning > > SAL_CALL SvxThesaurusDialog_Impl::queryMeanings_Impl(
+uno::Sequence< uno::Reference< linguistic2::XMeaning > > SvxThesaurusDialog::queryMeanings_Impl(
OUString& rTerm,
const lang::Locale& rLocale,
const beans::PropertyValues& rProperties )
... etc. - the rest is truncated
More information about the Libreoffice-commits
mailing list