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

unused wizards basic file and dialog

Change-Id: I56e82ab480b33d3205516e371302b1a091678e22
üst a0effa00
......@@ -23,9 +23,7 @@ $(eval $(call gb_Package_add_files,wizards_basicsrvtemplate,$(LIBO_SHARE_FOLDER)
Autotext.xba \
Correspondence.xba \
dialog.xlb \
DialogStyles.xdl \
ModuleAgenda.xba \
Samples.xba \
script.xlb \
TemplateDialog.xdl \
))
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE dlg:window PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "dialog.dtd">
<!--
* 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 .
-->
<dlg:window xmlns:dlg="http://openoffice.org/2000/dialog" xmlns:script="http://openoffice.org/2000/script" dlg:id="DialogStyles" dlg:left="170" dlg:top="93" dlg:width="120" dlg:height="169" dlg:help-url="HID:WIZARDS_HID_DLGSTYLES_DIALOG" dlg:closeable="true" dlg:moveable="true">
<dlg:bulletinboard>
<dlg:button dlg:id="cmdCancel" dlg:tab-index="0" dlg:left="5" dlg:top="150" dlg:width="50" dlg:height="13" dlg:help-url="HID:WIZARDS_HID_DLGSTYLES_CANCEL" dlg:value="cmdCancel">
<script:event script:event-name="on-performaction" script:macro-name="vnd.sun.star.script:Template.Samples.RestoreCurrentStyles?language=Basic&amp;location=application" script:language="Script"/>
</dlg:button>
<dlg:button dlg:id="cmdOk" dlg:tab-index="1" dlg:left="65" dlg:top="150" dlg:width="50" dlg:height="12" dlg:help-url="HID:WIZARDS_HID_DLGSTYLES_OKAY" dlg:value="cmdOk">
<script:event script:event-name="on-performaction" script:macro-name="vnd.sun.star.script:Template.Samples.CloseStyleDialog?language=Basic&amp;location=application" script:language="Script"/>
</dlg:button>
<dlg:menulist dlg:id="lbStyles" dlg:tab-index="2" dlg:left="5" dlg:top="5" dlg:width="110" dlg:height="133" dlg:help-url="HID:WIZARDS_HID_DLGSTYLES_LISTBOX">
<script:event script:event-name="on-itemstatechange" script:macro-name="vnd.sun.star.script:Template.Samples.SelectStyle?language=Basic&amp;location=application" script:language="Script"/>
</dlg:menulist>
</dlg:bulletinboard>
</dlg:window>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
<!--
* 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 .
-->
<script:module xmlns:script="http://openoffice.org/2000/script" script:name="Samples" script:language="StarBasic">Option Explicit
Const SAMPLES = 1000
Const STYLES = 1100
Const STYLENAME_DEF = 1120
Const STYLENAME = 1150
Const NumStyles = 18
Const aTempFileName = &quot;Berend_Ilko_Tom_Stella_Volker.stc&quot;
Public Const Twip = 425
Dim oUcbObject as Object
Public StylesDir as String
Public StylesDialog as Object
Public PathSeparator as String
Public oFamilies as Object
Public aOptions(0) as New com.sun.star.beans.PropertyValue
Public sQueryPath as String
Public NoArgs()as New com.sun.star.beans.PropertyValue
Public aTempURL as String
Public Files(100) as String
&apos;--------------------------------------------------------------------------------------
&apos;Miscellaneous Section starts here
Function PrepareForEditing(Optional ByVal oDocument)
&apos;This sub is called when sample documents are loaded (load event).
&apos;It checks whether the documents is read-only, in which case it
&apos;offers the user to create a new (writable) document using the original
&apos;as a template.
Dim DocPath as String
Dim MMessage as String
Dim MTitle as String
Dim RValue as Integer
Dim oNewDocument as Object
Dim mFileProperties(1) as New com.sun.star.beans.PropertyValue
PrepareForEditing = NULL
BasicLibraries.LoadLibrary( &quot;Tools&quot; )
If InitResources(&quot;&apos;Template&apos;&quot;, &quot;tpl&quot;) then
If IsMissing(oDocument) Then
oDocument = ThisComponent
End If
If oDocument.IsReadOnly then
MMessage = GetResText(SAMPLES)
MTitle = GetResText(SAMPLES + 1)
RValue = Msgbox(MMessage, (128+48+1), MTitle)
If RValue = 1 Then
DocPath = oDocument.URL
mFileProperties(0).Name = &quot;AsTemplate&quot;
mFileProperties(0).Value = True
mFileProperties(1).Name = &quot;MacroExecutionMode&quot;
mFileProperties(1).Value = com.sun.star.document.MacroExecMode.USE_CONFIG
oNewDocument = StarDesktop.LoadComponentFromURL(DocPath,&quot;_default&quot;,0, mFileProperties())
PrepareForEditing() = oNewDocument
DisposeDocument(oDocument)
Else
PrepareForEditing() = NULL
End If
Else
PrepareForEditing() = oDocument
End If
End If
End Function
&apos;--------------------------------------------------------------------------------------
&apos;Calc Style Section starts here
Sub ShowStyles
&apos;This sub displays the style selection dialog if the current document is a calc document.
Dim TemplateDir, ActFileTitle, DisplayDummy as String
Dim sFilterName(0) as String
Dim StyleNames() as String
Dim LocalizedStyleNames(NumStyles,2) As String
Dim LocalizedStyleName As String
Dim t as Integer
Dim MaxIndex as Integer
BasicLibraries.LoadLibrary(&quot;Tools&quot;)
If InitResources(&quot;&apos;Template&apos;&quot;, &quot;tpl&quot;) then
oDocument = ThisComponent
If oDocument.SupportsService(&quot;com.sun.star.sheet.SpreadsheetDocument&quot;) Then
ToggleWindow(False)
oUcbObject = createUnoService(&quot;com.sun.star.ucb.SimpleFileAccess&quot;)
oFamilies = oDocument.StyleFamilies
SaveCurrentStyles(oDocument)
StylesDialog = LoadDialog(&quot;Template&quot;, &quot;DialogStyles&quot;)
DialogModel = StylesDialog.Model
TemplateDir = GetPathSettings(&quot;Template&quot;, False, 0)
StylesDir = GetOfficeSubPath(&quot;Template&quot;, &quot;wizard/styles/&quot;)
sQueryPath = GetOfficeSubPath(&quot;Template&quot;, &quot;../wizard/bitmap/&quot;)
DialogModel.Title = GetResText(STYLES)
DialogModel.cmdCancel.Label = GetResText(STYLES+2)
DialogModel.cmdOk.Label = GetResText(STYLES+3)
For t = 0 to NumStyles - 1
LocalizedStyleNames(t,0) = GetResText(STYLENAME_DEF+t)
LocalizedStyleNames(t,1) = GetResText(STYLENAME+t)
Next t
Stylenames() = ReadDirectories(StylesDir, False, False, True,)
MaxIndex = Ubound(Stylenames())
For t = 0 to MaxIndex
LocalizedStyleName = StringInMultiArray(LocalizedStyleNames(), StyleNames(t,1), 0, 1)
If LocalizedStyleName &lt;&gt; "" Then
StyleNames(t,1) = LocalizedStyleName
End If
Next t
BubbleSortList(Stylenames(),True)
Dim cStyles(MaxIndex)
For t = 0 to MaxIndex
Files(t) = StyleNames(t,0)
cStyles(t) = StyleNames(t,1)
Next t
On Local Error Resume Next
DialogModel.lbStyles.StringItemList() = cStyles()
ToggleWindow(True)
StylesDialog.Execute
End If
End If
End Sub
Sub SelectStyle
&apos;This sub loads the specific styles from a style document and loads them into the
&apos;current document.
Dim StylePath as String
Dim NewStyle as String
Dim Position as Integer
Position = DialogModel.lbStyles.SelectedItems(0)
If Position &gt; -1 Then
ToggleWindow(False)
StylePath = Files(Position)
aOptions(0).Name = &quot;OverwriteStyles&quot;
aOptions(0).Value = true
oFamilies.loadStylesFromURL(StylePath, aOptions())
ToggleWindow(True)
End If
End Sub
Sub SaveCurrentStyles(oDocument as Object)
&apos;This sub stores the current document in the user work directory
On Error Goto ErrorOcurred
aTempURL = GetPathSettings(&quot;Work&quot;, False)
Dim aRightMost as String
aRightMost = Right(aTempURL, 1)
if aRightMost = &quot;/&quot; Then
aTempURL = aTempURL &amp; aTempFileName
Else
aTempURL = aTempURL &amp; &quot;/&quot; &amp; aTempFileName
End If
While FileExists(aTempURL)
aTempURL=Left(aTempURL,(Len(aTempURL)-4)) &amp; &quot;_1.stc&quot;
Wend
oDocument.storeToURL(aTempURL, NoArgs())
Exit Sub
ErrorOcurred:
MsgBox(GetResText( STYLES+1 ), 16, GetResText( STYLES ))
On Local Error Goto 0
End Sub
Sub RestoreCurrentStyles
&apos;This sub retrieves the styles from the temporarily save document
ToggleWindow(False)
On Local Error Goto NoFile
If FileExists(aTempURL) Then
aOptions(0).Name = &quot;OverwriteStyles&quot;
aOptions(0).Value = true
oFamilies.LoadStylesFromURL(aTempURL, aOptions())
KillTempFile()
End If
StylesDialog.EndExecute
ToggleWindow(True)
NOFILE:
If Err &lt;&gt; 0 Then
Msgbox(&quot;Cannot load Document from &quot; &amp; aTempUrl, 64, GetProductname())
End If
On Local Error Goto 0
End Sub
Sub CloseStyleDialog
KillTempFile()
DialogExited = True
StylesDialog.Endexecute
End Sub
Sub KillTempFile()
If oUcbObject.Exists(aTempUrl) Then
oUcbObject.Kill(aTempUrl)
End If
End Sub
</script:module>
\ No newline at end of file
......@@ -3,6 +3,5 @@
<library:library xmlns:library="http://openoffice.org/2000/library" library:name="Template" library:readonly="true" library:passwordprotected="false">
<library:element library:name="ModuleAgenda"/>
<library:element library:name="Correspondence"/>
<library:element library:name="Samples"/>
<library:element library:name="Autotext"/>
</library:library>
......@@ -16,10 +16,6 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#define SAMPLES 1000
#define STYLES 1100
#define STYLENAME_DEF 1120
#define STYLENAME 1150
#define AgendaDlgName 1200
#define AgendaDlgNoCancel 1201
#define AgendaDlgFrame 1202
......@@ -30,217 +26,6 @@
#define CorrespondenceDialog 1303
#define CorrespondenceFields 1350
#define TextField 1400
#define Newsletter 1450
String SAMPLES
{
Text [ en-US ] = "In order to use the full functionality of this sample, create a document that is based on this template.";
};
String SAMPLES + 1
{
Text [ en-US ] = "Remarks";
};
String STYLES
{
Text [ en-US ] = "Theme Selection";
};
String STYLES + 1
{
Text [ en-US ] = "Error while saving the document to the clipboard! The following action cannot be undone.";
};
String STYLES + 2
{
Text [ en-US ] = "~Cancel";
};
String STYLES + 3
{
Text [ en-US ] = "~OK";
};
String STYLENAME_DEF
{
Text = "(Standard)";
};
String STYLENAME_DEF + 1
{
Text = "Autumn Leaves";
};
String STYLENAME_DEF + 2
{
Text = "Be";
};
String STYLENAME_DEF + 3
{
Text = "Black and White";
};
String STYLENAME_DEF + 4
{
Text = "Blackberry Bush";
};
String STYLENAME_DEF + 5
{
Text = "Blue Jeans";
};
String STYLENAME_DEF + 6
{
Text = "Fifties Diner";
};
String STYLENAME_DEF + 7
{
Text = "Glacier";
};
String STYLENAME_DEF + 8
{
Text = "Green Grapes";
};
String STYLENAME_DEF + 9
{
Text = "Marine";
};
String STYLENAME_DEF + 10
{
Text = "Millennium";
};
String STYLENAME_DEF + 11
{
Text = "Nature";
};
String STYLENAME_DEF + 12
{
Text = "Neon";
};
String STYLENAME_DEF + 13
{
Text = "Night";
};
String STYLENAME_DEF + 14
{
Text = "PC Nostalgia";
};
String STYLENAME_DEF + 15
{
Text = "Pastel";
};
String STYLENAME_DEF + 16
{
Text = "Pool Party";
};
String STYLENAME_DEF + 17
{
Text = "Pumpkin";
};
String STYLENAME
{
Text [ en-US ] = "(Standard)";
};
String STYLENAME + 1
{
Text [ en-US ] = "Autumn Leaves";
};
String STYLENAME + 2
{
Text [ en-US ] = "Be";
};
String STYLENAME + 3
{
Text [ en-US ] = "Black and White";
};
String STYLENAME + 4
{
Text [ en-US ] = "Blackberry Bush";
};
String STYLENAME + 5
{
Text [ en-US ] = "Blue Jeans";
};
String STYLENAME + 6
{
Text [ en-US ] = "Fifties Diner";
};
String STYLENAME + 7
{
Text [ en-US ] = "Glacier";
};
String STYLENAME + 8
{
Text [ en-US ] = "Green Grapes";
};
String STYLENAME + 9
{
Text [ en-US ] = "Marine";
};
String STYLENAME + 10
{
Text [ en-US ] = "Millennium";
};
String STYLENAME + 11
{
Text [ en-US ] = "Nature";
};
String STYLENAME + 12
{
Text [ en-US ] = "Neon";
};
String STYLENAME + 13
{
Text [ en-US ] = "Night";
};
String STYLENAME + 14
{
Text [ en-US ] = "PC Nostalgia";
};
String STYLENAME + 15
{
Text [ en-US ] = "Pastel";
};
String STYLENAME + 16
{
Text [ en-US ] = "Pool Party";
};
String STYLENAME + 17
{
Text [ en-US ] = "Pumpkin";
};
String AgendaDlgName
{
......@@ -468,39 +253,4 @@ String TextField
};
String Newsletter
{
Text [ en-US ] = "General layout";
};
String Newsletter + 1
{
Text [ en-US ] = "Default layout";
};
String Newsletter + 2
{
Text [ en-US ] = "Commemorative publication layout";
};
String Newsletter + 3
{
Text [ en-US ] = "Brochure layout";
};
String Newsletter + 10
{
Text [ en-US ] = "Format";
};
String Newsletter + 11
{
Text [ en-US ] = "Single-sided";
};
String Newsletter + 12
{
Text [ en-US ] = "Double-sided";
};
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment