2010-10-14 08:30:41 +02:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2012-07-04 15:25:45 +01:00
|
|
|
/*
|
|
|
|
* 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 .
|
|
|
|
*/
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
#include <tools/globname.hxx>
|
|
|
|
#include <vcl/status.hxx>
|
|
|
|
#include <sfx2/msg.hxx>
|
|
|
|
#include <sfx2/objface.hxx>
|
2009-10-16 00:05:16 +02:00
|
|
|
#include <svl/whiter.hxx>
|
2000-09-18 16:07:07 +00:00
|
|
|
#include <sfx2/request.hxx>
|
|
|
|
#include <sfx2/sfx.hrc>
|
2002-12-12 14:40:33 +00:00
|
|
|
#include <sfx2/viewsh.hxx>
|
2000-09-18 16:07:07 +00:00
|
|
|
#include <vcl/wrkwin.hxx>
|
|
|
|
#include <svx/svxids.hrc>
|
|
|
|
#include <vcl/msgbox.hxx>
|
2005-04-04 07:05:47 +00:00
|
|
|
#include <vcl/virdev.hxx>
|
2009-10-16 00:05:16 +02:00
|
|
|
#include <unotools/syslocale.hxx>
|
2002-12-12 14:40:33 +00:00
|
|
|
#include <tools/rtti.hxx>
|
2000-09-18 16:07:07 +00:00
|
|
|
#include "smmod.hxx"
|
|
|
|
#include "symbol.hxx"
|
2015-05-26 08:38:37 +02:00
|
|
|
#include "cfgitem.hxx"
|
2000-09-18 16:07:07 +00:00
|
|
|
#include "dialog.hxx"
|
2002-12-12 14:40:33 +00:00
|
|
|
#include "edit.hxx"
|
|
|
|
#include "view.hxx"
|
2000-09-18 16:07:07 +00:00
|
|
|
#include "starmath.hrc"
|
2010-09-29 17:10:28 -04:00
|
|
|
#include "svx/modctrl.hxx"
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2003-09-19 07:53:40 +00:00
|
|
|
TYPEINIT1( SmModule, SfxModule );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
#define SmModule
|
|
|
|
#include "smslots.hxx"
|
|
|
|
|
2004-08-31 11:25:17 +00:00
|
|
|
#include <svx/xmlsecctrl.hxx>
|
|
|
|
|
|
|
|
|
2003-09-19 07:53:40 +00:00
|
|
|
|
2011-01-14 17:19:25 +01:00
|
|
|
SmResId::SmResId( sal_uInt16 nId )
|
2007-04-26 07:14:44 +00:00
|
|
|
: ResId(nId, *SM_MOD()->GetResMgr())
|
2003-09-19 07:53:40 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2014-02-25 20:41:20 +01:00
|
|
|
|
2001-08-02 14:37:39 +00:00
|
|
|
|
|
|
|
SmLocalizedSymbolData::SmLocalizedSymbolData() :
|
|
|
|
Resource( SmResId(RID_LOCALIZED_NAMES) ),
|
2007-04-26 07:14:44 +00:00
|
|
|
aUiSymbolNamesAry ( SmResId(RID_UI_SYMBOL_NAMES) ),
|
|
|
|
aExportSymbolNamesAry ( SmResId(RID_EXPORT_SYMBOL_NAMES) ),
|
|
|
|
aUiSymbolSetNamesAry ( SmResId(RID_UI_SYMBOLSET_NAMES) ),
|
2013-09-08 22:29:30 +02:00
|
|
|
aExportSymbolSetNamesAry( SmResId(RID_EXPORT_SYMBOLSET_NAMES) )
|
2001-08-02 14:37:39 +00:00
|
|
|
{
|
|
|
|
FreeResource();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
SmLocalizedSymbolData::~SmLocalizedSymbolData()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2001-08-28 06:47:20 +00:00
|
|
|
|
2015-05-05 13:11:02 +02:00
|
|
|
const OUString SmLocalizedSymbolData::GetUiSymbolName( const OUString &rExportName )
|
2001-08-28 06:47:20 +00:00
|
|
|
{
|
2013-09-03 18:29:30 +02:00
|
|
|
OUString aRes;
|
2001-08-28 06:47:20 +00:00
|
|
|
|
2009-09-28 10:46:54 +00:00
|
|
|
const SmLocalizedSymbolData &rData = SM_MOD()->GetLocSymbolData();
|
2001-08-28 06:47:20 +00:00
|
|
|
const ResStringArray &rUiNames = rData.GetUiSymbolNamesArray();
|
|
|
|
const ResStringArray &rExportNames = rData.GetExportSymbolNamesArray();
|
2013-09-04 17:09:22 +02:00
|
|
|
sal_uInt32 nCount = rExportNames.Count();
|
|
|
|
for (sal_uInt32 i = 0; i < nCount && aRes.isEmpty(); ++i)
|
2001-08-28 06:47:20 +00:00
|
|
|
{
|
2012-05-24 07:36:47 +01:00
|
|
|
if (rExportNames.GetString(i).equals(rExportName))
|
2001-08-28 06:47:20 +00:00
|
|
|
{
|
|
|
|
aRes = rUiNames.GetString(i);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return aRes;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-05-05 13:11:02 +02:00
|
|
|
const OUString SmLocalizedSymbolData::GetExportSymbolName( const OUString &rUiName )
|
2001-08-28 06:47:20 +00:00
|
|
|
{
|
2013-09-03 18:29:30 +02:00
|
|
|
OUString aRes;
|
2001-08-28 06:47:20 +00:00
|
|
|
|
2009-09-28 10:46:54 +00:00
|
|
|
const SmLocalizedSymbolData &rData = SM_MOD()->GetLocSymbolData();
|
2001-08-28 06:47:20 +00:00
|
|
|
const ResStringArray &rUiNames = rData.GetUiSymbolNamesArray();
|
|
|
|
const ResStringArray &rExportNames = rData.GetExportSymbolNamesArray();
|
2013-09-04 17:09:22 +02:00
|
|
|
sal_uInt32 nCount = rUiNames.Count();
|
|
|
|
for (sal_uInt32 i = 0; i < nCount && aRes.isEmpty(); ++i)
|
2001-08-28 06:47:20 +00:00
|
|
|
{
|
2012-05-24 07:36:47 +01:00
|
|
|
if (rUiNames.GetString(i).equals(rUiName))
|
2001-08-28 06:47:20 +00:00
|
|
|
{
|
|
|
|
aRes = rExportNames.GetString(i);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return aRes;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-05-05 13:11:02 +02:00
|
|
|
const OUString SmLocalizedSymbolData::GetUiSymbolSetName( const OUString &rExportName )
|
2001-08-28 06:47:20 +00:00
|
|
|
{
|
2013-09-03 18:29:30 +02:00
|
|
|
OUString aRes;
|
2001-08-28 06:47:20 +00:00
|
|
|
|
2009-09-28 10:46:54 +00:00
|
|
|
const SmLocalizedSymbolData &rData = SM_MOD()->GetLocSymbolData();
|
2001-08-28 06:47:20 +00:00
|
|
|
const ResStringArray &rUiNames = rData.GetUiSymbolSetNamesArray();
|
|
|
|
const ResStringArray &rExportNames = rData.GetExportSymbolSetNamesArray();
|
2013-09-04 17:09:22 +02:00
|
|
|
sal_uInt32 nCount = rExportNames.Count();
|
|
|
|
for (sal_uInt32 i = 0; i < nCount && aRes.isEmpty(); ++i)
|
2001-08-28 06:47:20 +00:00
|
|
|
{
|
2012-05-24 07:36:47 +01:00
|
|
|
if (rExportNames.GetString(i).equals(rExportName))
|
2001-08-28 06:47:20 +00:00
|
|
|
{
|
|
|
|
aRes = rUiNames.GetString(i);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return aRes;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-05-05 13:11:02 +02:00
|
|
|
const OUString SmLocalizedSymbolData::GetExportSymbolSetName( const OUString &rUiName )
|
2001-08-28 06:47:20 +00:00
|
|
|
{
|
2013-09-03 18:29:30 +02:00
|
|
|
OUString aRes;
|
2001-08-28 06:47:20 +00:00
|
|
|
|
2009-09-28 10:46:54 +00:00
|
|
|
const SmLocalizedSymbolData &rData = SM_MOD()->GetLocSymbolData();
|
2001-08-28 06:47:20 +00:00
|
|
|
const ResStringArray &rUiNames = rData.GetUiSymbolSetNamesArray();
|
|
|
|
const ResStringArray &rExportNames = rData.GetExportSymbolSetNamesArray();
|
2013-09-04 17:09:22 +02:00
|
|
|
sal_uInt32 nCount = rUiNames.Count();
|
|
|
|
for (sal_uInt32 i = 0; i < nCount && aRes.isEmpty(); ++i)
|
2001-08-28 06:47:20 +00:00
|
|
|
{
|
2012-05-24 07:36:47 +01:00
|
|
|
if (rUiNames.GetString(i).equals(rUiName))
|
2001-08-28 06:47:20 +00:00
|
|
|
{
|
|
|
|
aRes = rExportNames.GetString(i);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return aRes;
|
|
|
|
}
|
|
|
|
|
2014-11-25 10:12:55 +00:00
|
|
|
SFX_IMPL_INTERFACE(SmModule, SfxModule)
|
2014-04-18 17:25:30 +02:00
|
|
|
|
|
|
|
void SmModule::InitInterface_Impl()
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2014-04-18 16:10:11 +02:00
|
|
|
GetStaticInterface()->RegisterStatusBar(SmResId(RID_STATUSBAR));
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
2003-09-19 07:53:40 +00:00
|
|
|
SmModule::SmModule(SfxObjectFactory* pObjFact) :
|
2015-04-17 11:56:07 +09:00
|
|
|
SfxModule(ResMgr::CreateResMgr("sm"), false, pObjFact, nullptr)
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2013-04-07 12:06:47 +02:00
|
|
|
SetName(OUString("StarMath"));
|
2010-09-29 17:10:28 -04:00
|
|
|
|
|
|
|
SvxModifyControl::RegisterControl(SID_DOC_MODIFIED, this);
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
SmModule::~SmModule()
|
|
|
|
{
|
2015-04-17 11:56:07 +09:00
|
|
|
if (mpColorConfig)
|
|
|
|
mpColorConfig->RemoveListener(this);
|
2015-04-28 11:41:31 +01:00
|
|
|
mpVirtualDev.disposeAndClear();
|
2002-01-11 14:36:08 +00:00
|
|
|
}
|
|
|
|
|
2003-03-27 11:01:26 +00:00
|
|
|
void SmModule::ApplyColorConfigValues( const svtools::ColorConfig &rColorCfg )
|
2002-12-12 14:40:33 +00:00
|
|
|
{
|
|
|
|
//invalidate all graphic and edit windows
|
|
|
|
const TypeId aSmViewTypeId = TYPE(SmViewShell);
|
|
|
|
SfxViewShell* pViewShell = SfxViewShell::GetFirst();
|
|
|
|
while (pViewShell)
|
|
|
|
{
|
|
|
|
if ((pViewShell->IsA(aSmViewTypeId)))
|
|
|
|
{
|
2014-12-03 10:43:00 +02:00
|
|
|
SmViewShell *pSmView = static_cast<SmViewShell *>(pViewShell);
|
2002-12-12 14:40:33 +00:00
|
|
|
pSmView->GetGraphicWindow().ApplyColorConfigValues( rColorCfg );
|
|
|
|
SmEditWindow *pEditWin = pSmView->GetEditWindow();
|
|
|
|
if (pEditWin)
|
|
|
|
pEditWin->ApplyColorConfigValues( rColorCfg );
|
|
|
|
}
|
|
|
|
pViewShell = SfxViewShell::GetNext( *pViewShell );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-03-27 11:01:26 +00:00
|
|
|
svtools::ColorConfig & SmModule::GetColorConfig()
|
2002-12-12 14:40:33 +00:00
|
|
|
{
|
2015-04-17 11:56:07 +09:00
|
|
|
if(!mpColorConfig)
|
2002-12-12 14:40:33 +00:00
|
|
|
{
|
2015-04-17 11:56:07 +09:00
|
|
|
mpColorConfig.reset(new svtools::ColorConfig);
|
|
|
|
ApplyColorConfigValues( *mpColorConfig );
|
|
|
|
mpColorConfig->AddListener(this);
|
2002-12-12 14:40:33 +00:00
|
|
|
}
|
2015-04-17 11:56:07 +09:00
|
|
|
return *mpColorConfig;
|
2002-12-12 14:40:33 +00:00
|
|
|
}
|
|
|
|
|
2009-10-16 00:05:16 +02:00
|
|
|
void SmModule::ConfigurationChanged( utl::ConfigurationBroadcaster*, sal_uInt32 )
|
2002-12-12 14:40:33 +00:00
|
|
|
{
|
2015-04-17 11:56:07 +09:00
|
|
|
ApplyColorConfigValues(*mpColorConfig);
|
2002-12-12 14:40:33 +00:00
|
|
|
}
|
|
|
|
|
2015-05-26 08:38:37 +02:00
|
|
|
SmMathConfig * SmModule::GetConfig()
|
2001-05-02 15:58:48 +00:00
|
|
|
{
|
2015-04-17 11:56:07 +09:00
|
|
|
if(!mpConfig)
|
2015-05-26 08:38:37 +02:00
|
|
|
mpConfig.reset(new SmMathConfig);
|
2015-04-17 11:56:07 +09:00
|
|
|
return mpConfig.get();
|
2001-05-02 15:58:48 +00:00
|
|
|
}
|
|
|
|
|
2009-09-28 10:46:54 +00:00
|
|
|
SmSymbolManager & SmModule::GetSymbolManager()
|
2005-10-05 15:51:32 +00:00
|
|
|
{
|
2009-09-28 10:46:54 +00:00
|
|
|
return GetConfig()->GetSymbolManager();
|
2005-10-05 15:51:32 +00:00
|
|
|
}
|
|
|
|
|
2015-04-17 11:56:07 +09:00
|
|
|
SmLocalizedSymbolData & SmModule::GetLocSymbolData()
|
|
|
|
{
|
|
|
|
if (!mpLocSymbolData)
|
|
|
|
mpLocSymbolData.reset(new SmLocalizedSymbolData);
|
|
|
|
return *mpLocSymbolData;
|
|
|
|
}
|
|
|
|
|
|
|
|
const SvtSysLocale& SmModule::GetSysLocale()
|
2001-08-02 14:37:39 +00:00
|
|
|
{
|
2015-04-17 11:56:07 +09:00
|
|
|
if( !mpSysLocale )
|
|
|
|
mpSysLocale.reset(new SvtSysLocale);
|
|
|
|
return *mpSysLocale;
|
|
|
|
}
|
|
|
|
|
|
|
|
VirtualDevice &SmModule::GetDefaultVirtualDev()
|
|
|
|
{
|
|
|
|
if (!mpVirtualDev)
|
|
|
|
{
|
2015-04-28 11:41:31 +01:00
|
|
|
mpVirtualDev.reset( VclPtr<VirtualDevice>::Create() );
|
2015-04-17 11:56:07 +09:00
|
|
|
mpVirtualDev->SetReferenceDevice( VirtualDevice::REFDEV_MODE_MSO1 );
|
|
|
|
}
|
|
|
|
return *mpVirtualDev;
|
2001-08-02 14:37:39 +00:00
|
|
|
}
|
2001-05-02 15:58:48 +00:00
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
void SmModule::GetState(SfxItemSet &rSet)
|
|
|
|
{
|
|
|
|
SfxWhichIter aIter(rSet);
|
|
|
|
|
2011-01-14 17:19:25 +01:00
|
|
|
for (sal_uInt16 nWh = aIter.FirstWhich(); 0 != nWh; nWh = aIter.NextWhich())
|
2000-09-18 16:07:07 +00:00
|
|
|
switch (nWh)
|
|
|
|
{
|
|
|
|
case SID_CONFIGEVENT :
|
|
|
|
rSet.DisableItem(SID_CONFIGEVENT);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-01-14 17:19:25 +01:00
|
|
|
SfxItemSet* SmModule::CreateItemSet( sal_uInt16 nId )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
SfxItemSet* pRet = 0;
|
|
|
|
if(nId == SID_SM_EDITOPTIONS)
|
|
|
|
{
|
|
|
|
pRet = new SfxItemSet(GetPool(),
|
|
|
|
//TP_SMPRINT
|
|
|
|
SID_PRINTSIZE, SID_PRINTSIZE,
|
|
|
|
SID_PRINTZOOM, SID_PRINTZOOM,
|
|
|
|
SID_PRINTTITLE, SID_PRINTTITLE,
|
|
|
|
SID_PRINTTEXT, SID_PRINTTEXT,
|
|
|
|
SID_PRINTFRAME, SID_PRINTFRAME,
|
|
|
|
SID_NO_RIGHT_SPACES, SID_NO_RIGHT_SPACES,
|
2010-10-13 11:39:15 +02:00
|
|
|
SID_SAVE_ONLY_USED_SYMBOLS, SID_SAVE_ONLY_USED_SYMBOLS,
|
2000-09-18 16:07:07 +00:00
|
|
|
0 );
|
|
|
|
|
|
|
|
GetConfig()->ConfigToItemSet(*pRet);
|
|
|
|
}
|
|
|
|
return pRet;
|
|
|
|
}
|
2011-01-14 17:19:25 +01:00
|
|
|
void SmModule::ApplyItemSet( sal_uInt16 nId, const SfxItemSet& rSet )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
if(nId == SID_SM_EDITOPTIONS)
|
|
|
|
{
|
|
|
|
GetConfig()->ItemSetToConfig(rSet);
|
|
|
|
}
|
|
|
|
}
|
2015-04-17 13:51:33 +01:00
|
|
|
VclPtr<SfxTabPage> SmModule::CreateTabPage( sal_uInt16 nId, vcl::Window* pParent, const SfxItemSet& rSet )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2015-04-17 13:51:33 +01:00
|
|
|
VclPtr<SfxTabPage> pRet;
|
2000-09-18 16:07:07 +00:00
|
|
|
if(nId == SID_SM_TP_PRINTOPTIONS)
|
|
|
|
pRet = SmPrintOptionsTabPage::Create( pParent, rSet );
|
|
|
|
return pRet;
|
|
|
|
|
|
|
|
}
|
2010-10-14 08:30:41 +02:00
|
|
|
|
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|